def test_parse_checks_and_statistics_roundtrip(checks, expectation): """ Test that parse checks correctly obtain statistics from checks and vice-versa. """ if expectation is ValueError: with pytest.raises(ValueError): schema_statistics.parse_checks(checks) return assert schema_statistics.parse_checks(checks) == expectation check_statistics = {check.name: check.statistics for check in checks} check_list = schema_statistics.parse_check_statistics(check_statistics) assert set(check_list) == set(checks)
def test_parse_checks_and_statistics_no_param(extra_registered_checks): """Ensure that an edge case where a check does not have parameters is appropriately handled.""" checks = [pa.Check.no_param_check()] expectation = {"no_param_check": {}} assert schema_statistics.parse_checks(checks) == expectation check_statistics = {check.name: check.statistics for check in checks} check_list = schema_statistics.parse_check_statistics(check_statistics) assert set(check_list) == set(checks)