Skip to content
Snippets Groups Projects
Verified Commit 6d76fca2 authored by Jesper Zedlitz's avatar Jesper Zedlitz
Browse files

unittest for Frictionless Data Resource

parent afa131ea
No related branches found
No related tags found
1 merge request!1Update Formats, Dependencies, and Dockerfile Configuration
...@@ -23,9 +23,6 @@ def is_valid(resource, file): ...@@ -23,9 +23,6 @@ def is_valid(resource, file):
return resource["schema_valid"] return resource["schema_valid"]
return True return True
except json.JSONDecodeError as e: except Exception as e:
resource["error"] = str(e)
return False
except UnicodeDecodeError as e:
resource["error"] = str(e) resource["error"] = str(e)
return False return False
{ {
"name": "ufo", "name": "ufo",
"type": "table", "type": "table",
"path": "http://localhost:8000/ufo.csv", "path": "tests/data/ufo.csv",
"format": "csv", "format": "csv",
"mediatype": "text/csv", "mediatype": "text/csv",
"encoding": "utf-8", "encoding": "utf-8",
......
...@@ -15,6 +15,13 @@ class TestJsonFormat(unittest.TestCase): ...@@ -15,6 +15,13 @@ class TestJsonFormat(unittest.TestCase):
self.assertFalse(is_valid(resource, file)) self.assertFalse(is_valid(resource, file))
self.assertIsNotNone(resource.get("error")) self.assertIsNotNone(resource.get("error"))
def test_is_valid__frictionless_valid(self):
resource = {}
with open("tests/data/ufo-resource.json", "r") as file:
self.assertTrue(is_valid(resource, file))
self.assertIsNone(resource.get("error"))
self.assertTrue(resource.get("schema_valid"))
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment