Skip to content

Commit ed35dbd

Browse files
committed
Clean up; Remove legacy check functions and schema
1 parent 3eb5362 commit ed35dbd

9 files changed

Lines changed: 137 additions & 1200 deletions

File tree

esdlvalidator/api/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ class ValidationType(Enum):
2424
})
2525

2626
schema_validation_check = app.api.model("check", {
27-
"function": fields.String(required=True, description="Name of the registered check function to run", enum=registered_check_funcs, example="not_null"),
27+
"function": fields.String(required=True, description="Name of the registered check function to run", enum=registered_check_funcs, example="attributes_validation"),
2828
"dataset": fields.String(required=True, description="Dataset to check on, use an alias from the selects", example="areas"),
29-
"args": fields.Raw(required=True, description="Arguments passed to the check function", example={"property": "scope", "counts_as_null": ["null"]}),
29+
"args": fields.Raw(required=True, description="Arguments passed to the check function", example={"null_checks": [{"attribute": "power", "count_as_null": ["0.0"]}], "valid_checks": []}),
3030
})
3131

3232
schema_validation = app.api.model("validation", {

esdlvalidator/validation/functions/check_child_attribute.py

Lines changed: 0 additions & 77 deletions
This file was deleted.

esdlvalidator/validation/functions/check_child_attribute_not_null.py

Lines changed: 0 additions & 188 deletions
This file was deleted.

esdlvalidator/validation/functions/check_not_null.py

Lines changed: 0 additions & 82 deletions
This file was deleted.

esdlvalidator/validation/functions/tests/test_function.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,15 @@ def test_instantiate_function_from_factory_wrong_param(self):
4949
with self.assertRaises(ValueError,):
5050
FunctionFactory.create(FunctionType.SELECT, "get", alias="my_alias", datasets=None, args={"this_is_an_arg": "Port"})
5151

52-
# TODO: fix test error
53-
# def test_instantiate_function_check_from_factory(self):
54-
# """Test if the factory is able to create and initialize a check function"""
52+
def test_instantiate_function_check_from_factory(self):
53+
"""Test if the factory is able to create and initialize a check function"""
5554

56-
# mockResource = types.SimpleNamespace()
57-
# mockResource.uuid_dict = {}
58-
# datasets = {"resource": mockResource}
55+
mockResource = types.SimpleNamespace()
56+
mockResource.uuid_dict = {}
57+
datasets = {"resource": mockResource}
5958

60-
# actual = FunctionFactory.create(FunctionType.CHECK, "not_null", datasets=datasets, value=10, args={})
61-
# self.assertIsNotNone(actual, "Create function should not be None")
59+
actual = FunctionFactory.create(FunctionType.CHECK, "attributes_validation", datasets=datasets, value=10, args={"null_checks": [], "valid_checks": []})
60+
self.assertIsNotNone(actual, "Create function should not be None")
6261

6362
def test_function_type_enum(self):
6463
"""Test if the function type enum is working"""

0 commit comments

Comments
 (0)