-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TST: Fixed xfail for tests in pandas/tests/tseries/offsets/test_offsets_properties.py #32465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4fd071c
d69692c
6112ddd
86415fa
10f5b72
a1ad09b
f18e402
30d9ef7
6cc8bc4
9087485
889b726
a33bb0c
5f4c9a6
d8a51f6
3a508cf
5251350
7507faa
635b28e
baf83d4
9389578
1802c60
273ca9d
664411f
e148ca7
0ea0151
5656456
648d17f
e4a9d0b
80ad207
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
jbrockmendel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am interested in doing that, anyone got a smart way of doing that? Will do that in a follow-up PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
(10 is arbitrary number here, you decide what is reasonable number |
||
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): | ||
jbrockmendel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# 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" | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It says here that on linux it always fails (at least this is how I understood it), but it passed on my machine (I run linux).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so I think I understood why this failing:
hypothesis.extra.dateutil.timezones
is usingdateutil.UTC
which is avaible only fromdateutils>=2.7.0
(https://dateutil.readthedocs.io/en/stable/tz.html#dateutil.tz.dateutil.tz.UTC)but macOS have a pinned
python-dateutils
to2.6.1
which then leads to errors.@jbrockmendel is bumping
python-dateutils
to2.7.0
is an option/reasonable thing to do?if not I will put a
pytest.mark.skipif
decorator (seems more likely to be the answer)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.7.0 is 2 days shy of 2 years old, so I think we're OK bumping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MomIsBestFriend this is definitely an improvement, but we can also just bump the dateutil requirement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! will do that in a separate PR