Exemplo n.º 1
0
    def test_lt_0(self):
        validator = StaticValidator(self.params)
        report = ValidationReport([])
        df = pd.DataFrame([-5], columns=["val"])
        validator.check_bad_val(df, FILENAME, "signal", report)

        assert len(report.raised_errors) == 1
        assert report.raised_errors[0].check_name == "check_val_lt_0"
Exemplo n.º 2
0
    def test_gt_max_prop(self):
        validator = StaticValidator(self.params)
        report = ValidationReport([])
        df = pd.DataFrame([1e7], columns=["val"])
        validator.check_bad_val(df, FILENAME, "prop", report)

        assert len(report.raised_errors) == 1
        assert report.raised_errors[0].check_name == "check_val_prop_gt_100k"
Exemplo n.º 3
0
    def test_empty_df(self):
        validator = StaticValidator(self.params)
        report = ValidationReport([])
        empty_df = pd.DataFrame(columns=["val"])
        validator.check_bad_val(empty_df, "", "", report)
        validator.check_bad_val(empty_df, "", "prop", report)
        validator.check_bad_val(empty_df, "", "pct", report)

        assert len(report.raised_errors) == 0