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
1 merge request!1Update Formats, Dependencies, and Dockerfile Configuration
......@@ -23,9 +23,6 @@ def is_valid(resource, file):
return resource["schema_valid"]
return True
except json.JSONDecodeError as e:
resource["error"] = str(e)
return False
except UnicodeDecodeError as e:
except Exception as e:
resource["error"] = str(e)
return False
{
"name": "ufo",
"type": "table",
"path": "http://localhost:8000/ufo.csv",
"path": "tests/data/ufo.csv",
"format": "csv",
"mediatype": "text/csv",
"encoding": "utf-8",
......
......@@ -15,6 +15,13 @@ class TestJsonFormat(unittest.TestCase):
self.assertFalse(is_valid(resource, file))
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__":
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment