diff --git a/AKModel/tests/test_json_export.py b/AKModel/tests/test_json_export.py index 80a08279cf8b70f115028b45f4c15747a41af419..5ec117497b2afd6bdb54cbc1507485303a2df451 100644 --- a/AKModel/tests/test_json_export.py +++ b/AKModel/tests/test_json_export.py @@ -37,7 +37,9 @@ class JSONExportTest(TestCase): is_active=True, ) - cls.json_export_validator = construct_schema_validator("solver-input.schema.json") + cls.json_export_validator = construct_schema_validator( + "solver-input.schema.json" + ) def setUp(self): self.client.force_login(self.admin_user) @@ -120,7 +122,9 @@ class JSONExportTest(TestCase): with self.subTest(event=event): self.set_up_event(event=event) - error = best_match(self.json_export_validator.iter_errors(self.export_dict)) + error = best_match( + self.json_export_validator.iter_errors(self.export_dict) + ) msg = "" if error is None else error.message self.assertTrue(error is None, msg) diff --git a/AKModel/utils.py b/AKModel/utils.py index b53e6509a0a813b4430ca001c156520c6df5a86a..3a0b3f0d57cb646954cd34a9a76c5903ee74cc10 100644 --- a/AKModel/utils.py +++ b/AKModel/utils.py @@ -7,6 +7,7 @@ from referencing import Registry, Resource from AKPlanning import settings + def construct_schema_validator(schema: str | dict) -> Validator: """Construct a validator for a JSON schema. @@ -23,6 +24,4 @@ def construct_schema_validator(schema: str | dict) -> Validator: if isinstance(schema, str): with (schema_base_path / schema).open("r") as ff: schema = json.load(ff) - return Draft202012Validator( - schema=schema, registry=registry - ) + return Draft202012Validator(schema=schema, registry=registry)