def test_max_value_column_constraint(): test_dataframe = DataFrame({'foo': [1, 1, 2, 3]}) assert (MaxValueColumnConstraint(5, ignore_missing_vals=False).validate( test_dataframe, 'foo') is None) with pytest.raises(ConstraintViolationException): MaxValueColumnConstraint(2, ignore_missing_vals=False).validate( test_dataframe, 'foo')
def test_max_valid_column_constraint_ignore_nan(): for nullable in NAN_VALUES: test_dataframe = DataFrame({'foo': [1, 1, 2, 3, nullable]}) assert (MaxValueColumnConstraint(5, ignore_missing_vals=True).validate( test_dataframe, 'foo') is None) with pytest.raises(ConstraintViolationException): MaxValueColumnConstraint(2, ignore_missing_vals=True).validate( test_dataframe, 'foo')
def test_max_value_column_constraint(): test_dataframe = DataFrame({'foo': [1, 1, 2, 3]}) assert MaxValueColumnConstraint(5).validate(test_dataframe, 'foo') is None with pytest.raises(ConstraintViolationException): assert MinValueColumnConstraint(2).validate(test_dataframe, 'foo')