class RoundsValidator(pv.DataFrameValidator): """ Rounds dataframe validator """ column_num = 5 l_round = pv.IntegerColumnValidator(constants.ROUND, min_value=1, max_value=38) l_ghome = pv.IntegerColumnValidator(constants.GOALS_HOME, min_value=0) l_gaway = pv.IntegerColumnValidator(constants.GOALS_AWAY, min_value=0)
def test_is_invalid(self): column_validator = pv.IntegerColumnValidator('label2') self.assertFalse(column_validator.is_valid(self.dataframe))
def test_is_valid(self): column_validator = pv.IntegerColumnValidator('label1') self.assertTrue(column_validator.is_valid(self.dataframe))
class DataFrameValidatorFixture(pv.DataFrameValidator): """Fixture for testing the validation of column type.""" integer_field = pv.IntegerColumnValidator('i') float_field = pv.FloatColumnValidator('f')