コード例 #1
0
ファイル: test_constraints.py プロジェクト: hhy5277/dagster
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')
コード例 #2
0
ファイル: test_constraints.py プロジェクト: hhy5277/dagster
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')
コード例 #3
0
ファイル: test_constraints.py プロジェクト: zkan/dagster
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')