Skip to content

Commit

Permalink
fix: make status values consistent across validation types (GoogleClo…
Browse files Browse the repository at this point in the history
  • Loading branch information
ajwelch4 committed Feb 26, 2022
1 parent 3d78ee5 commit a56165f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions data_validation/schema_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def schema_validation_matching(source_fields, target_fields):
source_field_name,
"1",
"1",
"Pass",
"success",
"Source_type:{} Target_type:{}".format(
source_field_type, target_fields[source_field_name]
),
Expand All @@ -114,7 +114,7 @@ def schema_validation_matching(source_fields, target_fields):
source_field_name,
"1",
"1",
"Fail",
"fail",
"Data type mismatch between source and target. Source_type:{} Target_type:{}".format(
source_field_type, target_fields[source_field_name]
),
Expand All @@ -128,7 +128,7 @@ def schema_validation_matching(source_fields, target_fields):
"N/A",
"1",
"0",
"Fail",
"fail",
"Target doesn't have a matching field name",
]
)
Expand All @@ -142,7 +142,7 @@ def schema_validation_matching(source_fields, target_fields):
target_field_name,
"0",
"1",
"Fail",
"fail",
"Source doesn't have a matching field name",
]
)
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/test_schema_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ def test_schema_validation_matching(module_under_test):
target_fields = {"field1": "string", "field2": "timestamp", "field_3": "string"}

expected_results = [
["field1", "field1", "1", "1", "Pass", "Source_type:string Target_type:string"],
["field1", "field1", "1", "1", "success", "Source_type:string Target_type:string"],
[
"field2",
"field2",
"1",
"1",
"Fail",
"fail",
"Data type mismatch between source and target. "
"Source_type:datetime Target_type:timestamp",
],
Expand All @@ -158,15 +158,15 @@ def test_schema_validation_matching(module_under_test):
"N/A",
"1",
"0",
"Fail",
"fail",
"Target doesn't have a matching field name",
],
[
"N/A",
"field_3",
"0",
"1",
"Fail",
"fail",
"Source doesn't have a matching field name",
],
]
Expand All @@ -188,7 +188,7 @@ def test_execute(module_under_test, fs):

dv_client = data_validation.DataValidation(SAMPLE_SCHEMA_CONFIG, verbose=True)
result_df = dv_client.schema_validator.execute()
failures = result_df[result_df["status"].str.contains("Fail")]
failures = result_df[result_df["status"].str.contains("fail")]

assert len(result_df) == len(source_data[0]) + 1
assert result_df["source_agg_value"].astype(float).sum() == 7
Expand Down

0 comments on commit a56165f

Please sign in to comment.