Beispiel #1
0
 def wrapper(*args, **kwargs):
     result = func(*args, **kwargs)
     ck.is_monotonic(result,
                     items=items,
                     increasing=increasing,
                     strict=strict)
     return result
Beispiel #2
0
def test_monotonic_either_stict():
    df = pd.DataFrame({'A': [1, 2, 3], 'B': [3, 2, 1]})
    tm.assert_frame_equal(df, ck.is_monotonic(df, strict=True))
    result = dc.is_monotonic(strict=True)(_add_one)(df)
    tm.assert_frame_equal(result, df + 1)

    df = pd.DataFrame({'A': [1, 2, 2], 'B': [3, 2, 2]})
    with pytest.raises(AssertionError):
        ck.is_monotonic(df, strict=True)
    with pytest.raises(AssertionError):
        dc.is_monotonic(strict=True)(_add_one)(df)
Beispiel #3
0
def test_monotonic_decreasing():
    df = pd.DataFrame([2, 2, 1])
    tm.assert_frame_equal(df, ck.is_monotonic(df, increasing=False))
    result = dc.is_monotonic(increasing=False)(_add_one)(df)
    tm.assert_frame_equal(result, df + 1)

    df = pd.DataFrame([1, 2, 1])
    with pytest.raises(AssertionError):
        ck.is_monotonic(df, increasing=False)
    with pytest.raises(AssertionError):
        dc.is_monotonic(increasing=False)(_add_one)(df)

    df = pd.DataFrame([1, 2, 3])
    with pytest.raises(AssertionError):
        ck.is_monotonic(df, increasing=False)
    with pytest.raises(AssertionError):
        dc.is_monotonic(increasing=False)(_add_one)(df)
Beispiel #4
0
def test_monotonic_increasing_strict():
    df = pd.DataFrame([1, 2, 3])
    tm.assert_frame_equal(df, ck.is_monotonic(df, increasing=True,
                                              strict=True))
    result = dc.is_monotonic(increasing=True, strict=True)(_add_one)(df)
    tm.assert_frame_equal(result, df + 1)

    df = pd.DataFrame([1, 2, 2])
    with pytest.raises(AssertionError):
        ck.is_monotonic(df, increasing=True, strict=True)
    with pytest.raises(AssertionError):
        dc.is_monotonic(increasing=True, strict=True)(_add_one)(df)

    df = pd.DataFrame([3, 2, 1])
    with pytest.raises(AssertionError):
        ck.is_monotonic(df, increasing=True, strict=True)
    with pytest.raises(AssertionError):
        dc.is_monotonic(increasing=True, strict=True)(_add_one)(df)
Beispiel #5
0
def test_monotonic_items():
    df = pd.DataFrame({'A': [1, 2, 3], 'B': [3, 2, 3]})
    tm.assert_frame_equal(df, ck.is_monotonic(df, items={'A': (True, True)}))
    tm.assert_frame_equal(
        dc.is_monotonic(items={'A': (True, True)}, strict=True)(_add_one)(df),
        df + 1)
Beispiel #6
0
 def wrapper(*args, **kwargs):
     result = func(*args, **kwargs)
     ck.is_monotonic(result, items=items, increasing=increasing,
                     strict=strict)
     return result