diff --git a/pandas/tests/tseries/offsets/test_offsets_properties.py b/pandas/tests/tseries/offsets/test_offsets_properties.py index 716d3ff3faf1c..6e01c83c725bf 100644 --- a/pandas/tests/tseries/offsets/test_offsets_properties.py +++ b/pandas/tests/tseries/offsets/test_offsets_properties.py @@ -85,8 +85,6 @@ # Offset-specific behaviour tests -# Based on CI runs: Always passes on OSX, fails on Linux, sometimes on Windows -@pytest.mark.xfail(strict=False, reason="inconsistent between OSs, Pythons") @given(gen_random_datetime, gen_yqm_offset) def test_on_offset_implementations(dt, offset): assume(not offset.normalize) @@ -97,40 +95,38 @@ def test_on_offset_implementations(dt, offset): assert offset.is_on_offset(dt) == (compare == dt) -@pytest.mark.xfail( - reason="res_v2 below is incorrect, needs to use the " - "commented-out version with tz_localize. " - "But with that fix in place, hypothesis then " - "has errors in timezone generation." -) @given(gen_yqm_offset, gen_date_range) def test_apply_index_implementations(offset, rng): # offset.apply_index(dti)[i] should match dti[i] + offset - assume(offset.n != 0) # TODO: test for that case separately - # rng = pd.date_range(start='1/1/2000', periods=100000, freq='T') + # TODO: test for that case separately + assume(offset.n != 0) + ser = pd.Series(rng) res = rng + offset - res_v2 = offset.apply_index(rng) - # res_v2 = offset.apply_index(rng.tz_localize(None)).tz_localize(rng.tz) + res_v2 = offset.apply_index(rng.tz_localize(None)).tz_localize(rng.tz) assert (res == res_v2).all() + # apply_index is only for indexes, not series, so no res2_v2 assert res[0] == rng[0] + offset assert res[-1] == rng[-1] + offset res2 = ser + offset - # apply_index is only for indexes, not series, so no res2_v2 + + # TODO: Check randomly assorted entries, not just first/last assert res2.iloc[0] == ser.iloc[0] + offset assert res2.iloc[-1] == ser.iloc[-1] + offset - # TODO: Check randomly assorted entries, not just first/last @pytest.mark.xfail # TODO: reason? @given(gen_yqm_offset) def test_shift_across_dst(offset): - # GH#18319 check that 1) timezone is correctly normalized and + # GH#18319 + # check that: + # 1) timezone is correctly normalized and # 2) that hour is not incorrectly changed by this normalization # Note that dti includes a transition across DST boundary + dti = pd.date_range( start="2017-10-30 12:00:00", end="2017-11-06", freq="D", tz="US/Eastern" )