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.IsMonotonic(strict=True)(_add_n)(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.IsMonotonic(strict=True)(_add_n)(df)
def test_monotonic_decreasing(): df = pd.DataFrame([2, 2, 1]) tm.assert_frame_equal(df, ck.is_monotonic(df, increasing=False)) result = dc.IsMonotonic(increasing=False)(_add_n)(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.IsMonotonic(increasing=False)(_add_n)(df) df = pd.DataFrame([1, 2, 3]) with pytest.raises(AssertionError): ck.is_monotonic(df, increasing=False) with pytest.raises(AssertionError): dc.IsMonotonic(increasing=False)(_add_n)(df)
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.IsMonotonic(items={'A': (True, True)}, strict=True)(_add_n)(df), df + 1)