def test_lt_min_missing_not_allowed(self): validator = StaticValidator(self.params) report = ValidationReport([]) validator.params.missing_sample_size_allowed = False df = pd.DataFrame([[1, 0, 10], [1, np.nan, 240], [1, np.nan, 245]], columns=["val", "se", "sample_size"]) validator.check_bad_sample_size(df, FILENAME, report) assert len(report.raised_errors) == 1 assert report.raised_errors[0].check_name == "check_n_gt_min"
def test_empty_df(self): validator = StaticValidator(self.params) report = ValidationReport([]) empty_df = pd.DataFrame(columns=["val", "se", "sample_size"], dtype=float) validator.check_bad_sample_size(empty_df, "", report) assert len(report.raised_errors) == 0 validator.params.missing_sample_size_allowed = True validator.check_bad_sample_size(empty_df, "", report) assert len(report.raised_errors) == 0