Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bas committed Sep 21, 2024
1 parent 981c3c3 commit ad86d74
Showing 1 changed file with 22 additions and 26 deletions.
48 changes: 22 additions & 26 deletions tests/test_input_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
read_data_quality_rules_from_json,
validate_data_quality_rules_dict,
validate_dataset,
validate_rule,
validate_rules_dict,
validate_table_schema,
validate_tables, validate_rule,
validate_tables,
)


Expand All @@ -19,9 +20,7 @@ def real_file_path():

@pytest.fixture
def data_quality_rules_json_string(real_file_path):
return read_data_quality_rules_from_json(
file_path=real_file_path
)
return read_data_quality_rules_from_json(file_path=real_file_path)


@pytest.fixture
Expand All @@ -44,7 +43,9 @@ def test_read_data_quality_rules_from_json_raises_file_not_found_error(
with pytest.raises(FileNotFoundError):
read_data_quality_rules_from_json(file_path="nonexistent_file_path")

def test_read_data_quality_rules_from_json_returns_json_string(self, real_file_path):
def test_read_data_quality_rules_from_json_returns_json_string(
self, real_file_path
):
data_quality_rules_json_string = read_data_quality_rules_from_json(
file_path=real_file_path
)
Expand All @@ -56,7 +57,9 @@ class TestLoadDataQualityRulesFromJsonString:
# TODO: implement tests for all failure paths (and raise errors in
# read_data_quality_rules_from_json)

def test_load_data_quality_rules_from_json_string(self, data_quality_rules_json_string):
def test_load_data_quality_rules_from_json_string(
self, data_quality_rules_json_string
):
data_quality_rules_dict = load_data_quality_rules_from_json_string(
dq_rules_json_string=data_quality_rules_json_string
)
Expand Down Expand Up @@ -127,9 +130,7 @@ def test_validate_dataset_without_str_typed_layer_raises_type_error(
}
)

def test_validate_dataset_works_as_expected(
self, data_quality_rules_dict
):
def test_validate_dataset_works_as_expected(self, data_quality_rules_dict):
validate_dataset(data_quality_rules_dict=data_quality_rules_dict)


Expand All @@ -151,9 +152,7 @@ def test_validate_tables_without_list_typed_value_raises_type_error(
data_quality_rules_dict={"tables": "with_some_value"}
)

def test_validate_tables_works_as_expected(
self, data_quality_rules_dict
):
def test_validate_tables_works_as_expected(self, data_quality_rules_dict):
validate_tables(data_quality_rules_dict=data_quality_rules_dict)


Expand Down Expand Up @@ -197,9 +196,7 @@ def test_validate_rules_dict_without_list_typed_rules_raises_type_error(
}
)

def test_validate_rules_dict_works_as_expected(
self, rules_dict
):
def test_validate_rules_dict_works_as_expected(self, rules_dict):
validate_rules_dict(rules_dict=rules_dict)


Expand Down Expand Up @@ -240,7 +237,7 @@ def test_validate_table_schema_works_as_expected(

class TestValidateRule:
def test_validate_rule_without_dict_typed_rule_raises_type_error(
self,
self,
):
with pytest.raises(TypeError):
validate_rule(rule="not_a_dict")
Expand All @@ -261,27 +258,26 @@ def test_validate_rule_without_string_typed_rule_name_raises_type_error(
self,
):
with pytest.raises(TypeError):
validate_rule(rule={"rule_name": 123,
"parameters": 456})
validate_rule(rule={"rule_name": 123, "parameters": 456})

def test_validate_rule_without_pascal_case_rule_name_raises_value_error(
self,
):
with pytest.raises(ValueError):
validate_rule(rule={"rule_name": "the_rule",
"parameters": 456})
validate_rule(rule={"rule_name": "the_rule", "parameters": 456})

def test_validate_rule_without_dict_typed_parameters_raises_type_error(
self,
):
with pytest.raises(TypeError):
validate_rule(rule={"rule_name": "TheRule",
"parameters": 456})
validate_rule(rule={"rule_name": "TheRule", "parameters": 456})

def test_validate_rule_works_as_expected(
self,
):
validate_rule(rule={"rule_name": "TheRule",
"parameters": {"some_key": "some_value"}
}
)
validate_rule(
rule={
"rule_name": "TheRule",
"parameters": {"some_key": "some_value"},
}
)

0 comments on commit ad86d74

Please sign in to comment.