def test_is_in_index_raises(): dr = pd.date_range(start='2015-01-01', periods=6, freq='D') da = range(6) da[2] = pd.np.nan df = pd.DataFrame(data = da, index=dr) d = dt.date(2015,1,12) with pytest.raises(AssertionError): ck.has_in_index(df, obj=d) with pytest.raises(AssertionError): dc.has_in_index(obj=d)(_add_one)(df) with pytest.raises(AssertionError): ck.has_in_index(df, obj=d, try_ix=True) ck.has_in_index(df, obj=d, try_ix=True, try_strftime="%Y-%m") d = dt.datetime(2015,1,3) ck.has_in_index(df, obj=d) ck.has_in_index(df, obj=d, check_na=False) with pytest.raises(AssertionError): ck.has_in_index(df, obj=d, check_na=True)
def test_is_in_index_raises(): dr = pd.date_range(start='2015-01-01', periods=6, freq='D') da = range(6) da[2] = pd.np.nan df = pd.DataFrame(data=da, index=dr) d = dt.date(2015, 1, 12) with pytest.raises(AssertionError): ck.has_in_index(df, obj=d) with pytest.raises(AssertionError): dc.has_in_index(obj=d)(_add_one)(df) with pytest.raises(AssertionError): ck.has_in_index(df, obj=d, try_ix=True) ck.has_in_index(df, obj=d, try_ix=True, try_strftime="%Y-%m") d = dt.datetime(2015, 1, 3) ck.has_in_index(df, obj=d) ck.has_in_index(df, obj=d, check_na=False) with pytest.raises(AssertionError): ck.has_in_index(df, obj=d, check_na=True)
def test_is_in_index(): dr = pd.date_range(start='2015-01-01', periods=6, freq='D') df = pd.DataFrame(data = range(6), index=dr) d = dt.date(2015,1,3) result = ck.has_in_index(df, obj=d) tm.assert_frame_equal(df, result) result = dc.has_in_index(obj=d)(_add_one)(df) tm.assert_frame_equal(result, df + 1) result = ck.has_in_index(df, obj=d, try_ix=True) result = ck.has_in_index(df, obj=d, try_ix=True, try_strftime="%Y-%m") result = ck.has_in_index(df, obj=d, check_na=True)
def test_is_in_index(): dr = pd.date_range(start='2015-01-01', periods=6, freq='D') df = pd.DataFrame(data=range(6), index=dr) d = dt.date(2015, 1, 3) result = ck.has_in_index(df, obj=d) tm.assert_frame_equal(df, result) result = dc.has_in_index(obj=d)(_add_one)(df) tm.assert_frame_equal(result, df + 1) result = ck.has_in_index(df, obj=d, try_ix=True) result = ck.has_in_index(df, obj=d, try_ix=True, try_strftime="%Y-%m") result = ck.has_in_index(df, obj=d, check_na=True)