Skip to content

Commit

Permalink
feat: Allow user to specify a format for stdout. Default format and T…
Browse files Browse the repository at this point in the history
…ext result handler test case fixes(#242)
  • Loading branch information
Yogesh Tewari committed Aug 10, 2021
1 parent 48b1581 commit 51f14e0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion data_validation/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def build_config_managers_from_args(args):
target_client = clients.get_data_client(target_conn)

threshold = args.threshold if args.threshold else 0.0
format = args.format if args.format else "table"

is_filesystem = True if source_conn["source_type"] == "FileSystem" else False
tables_list = cli_tools.get_tables_list(
Expand All @@ -143,7 +144,7 @@ def build_config_managers_from_args(args):
table_obj,
labels,
threshold,
format=args.format,
format,
result_handler_config=result_handler_config,
filter_config=filter_config,
verbose=args.verbose,
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/result_handlers/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,13 @@ def test_basic_result_handler(module_under_test):

handler_output = result_handler.execute(SAMPLE_CONFIG, result_df)
assert handler_output["count"].sum() == result_df["count"].sum()


def test_unsupported_result_format(module_under_test):
"""Check for invalid format"""
with pytest.raises(ValueError):
result_df = DataFrame(SAMPLE_RESULT_DATA)
result_handler = module_under_test.TextResultHandler(format="foobar")

handler_output = result_handler.execute(SAMPLE_CONFIG, result_df)
assert handler_output["count"].sum() == result_df["count"].sum()

0 comments on commit 51f14e0

Please sign in to comment.