def test_empty_df(self): validator = StaticValidator(self.params) report = ValidationReport([]) empty_df = pd.DataFrame(columns=["geo_id"], dtype=str) validator.check_bad_geo_id_format(empty_df, FILENAME, "county", report) assert len(report.raised_errors) == 0
def test_invalid_geo_id_format_hhs(self): validator = StaticValidator(self.params) report = ValidationReport([]) df = pd.DataFrame(["1", "112"], columns=["geo_id"]) validator.check_bad_geo_id_format(df, FILENAME, "hhs", report) assert len(report.raised_errors) == 1 assert report.raised_errors[0].check_name == "check_geo_id_format"
def test_invalid_geo_type(self): validator = StaticValidator(self.params) report = ValidationReport([]) empty_df = pd.DataFrame(columns=["geo_id"], dtype=str) validator.check_bad_geo_id_format(empty_df, FILENAME, "hello", report) assert len(report.raised_errors) == 1 assert report.raised_errors[0].check_name == "check_geo_type"
def test_invalid_geo_id_format_state(self): validator = StaticValidator(self.params) report = ValidationReport([]) df = pd.DataFrame(["aa", "hi", "HI", "hawaii", "Hawaii", "a", "H.I."], columns=["geo_id"]) validator.check_bad_geo_id_format(df, FILENAME, "state", report) assert len(report.raised_errors) == 1 assert report.raised_errors[0].check_name == "check_geo_id_format"