-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
TST: Clean old timezone issues PT2 #21612
Conversation
Codecov Report
@@ Coverage Diff @@
## master #21612 +/- ##
==========================================
+ Coverage 91.9% 91.9% +<.01%
==========================================
Files 154 154
Lines 49555 49558 +3
==========================================
+ Hits 45542 45545 +3
Misses 4013 4013
Continue to review full report at Codecov.
|
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.
@mroeschke can you break to 2 PRs, 1 which moves the issues out of 0.23.2 (just because want to cut 0.23.2 soon, so need to move)
pandas/conftest.py
Outdated
operator.ge, operator.gt] | ||
|
||
|
||
@pytest.fixture(params=COMPARISON_OPERATORS) |
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.
make this more like this
[email protected](params=['__eq__', '__ne__', '__le__',
+ '__lt__', '__ge__', '__gt__'])
+def all_compare_operators(request):
+ """
+ Fixture for dunder names for common compare operations
"""
which is much more flexible for non-operators
pandas/tests/frame/test_indexing.py
Outdated
@@ -2248,6 +2262,16 @@ def test_setitem_datetimelike_with_inference(self): | |||
index=list('ABCDEFGH')) | |||
assert_series_equal(result, expected) | |||
|
|||
@pytest.mark.parametrize('idxer', ['var', ['var']]) | |||
@pytest.mark.parametrize('tz', [None, 'UTC']) |
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.
try to use the tz fixtures if possible
@@ -1185,3 +1185,11 @@ def test_constructor_range_dtype(self, dtype): | |||
expected = Series([0, 1, 2, 3, 4], dtype=dtype or 'int64') | |||
result = Series(range(5), dtype=dtype) | |||
tm.assert_series_equal(result, expected) | |||
|
|||
def test_constructor_tz_aware_and_tz_naive_data(self): |
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.
call this tz_mixed
pandas/tests/series/test_replace.py
Outdated
@@ -249,3 +249,12 @@ def test_replace_mixed_types_with_string(self): | |||
result = s.replace([2, '4'], np.nan) | |||
expected = pd.Series([1, np.nan, 3, np.nan, 4, 5]) | |||
tm.assert_series_equal(expected, result) | |||
|
|||
@pytest.mark.parametrize('to_replace', [pd.NaT, [np.nan, pd.NaT]]) |
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.
I think we have a fixture for nulls
pandas/tests/frame/test_indexing.py
Outdated
@@ -1688,6 +1688,20 @@ def test_getitem_list_duplicates(self): | |||
expected = df.iloc[:, 2:] | |||
assert_frame_equal(result, expected) | |||
|
|||
def test_getitem_setitem_datetimeindex_tz(self): |
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.
I think there are other tests like this, can you co-locate (IIRC in same file), maybe though in pandas/tests/indexing/....
@@ -292,6 +292,15 @@ def test_construct_over_dst(self): | |||
freq='H', tz='US/Pacific') | |||
tm.assert_index_equal(result, expected) | |||
|
|||
def test_construct_with_different_start_end_string_format(self): | |||
# GH 12064 |
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.
not sure this is actually testing what is in the issue, as there were provided tz's there.
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.
tz aren't provided in these examples via the keyword arg. The issue was that '2013-01-01 00:00:00+09:00'
vs '2013/01/01 02:00:00+09:00'
(note the -
vs the /
) ended up produced different tzoffsets
@@ -450,6 +450,14 @@ def test_offset_deprecated(self): | |||
with tm.assert_produces_warning(FutureWarning): | |||
idx.offset = BDay() | |||
|
|||
def test_ts_datetimeindex_compare_mismatched_tz(self, comparison_fixture): |
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.
we have similar tests, can you co-locate
pandas/tests/series/test_replace.py
Outdated
@@ -249,3 +249,12 @@ def test_replace_mixed_types_with_string(self): | |||
result = s.replace([2, '4'], np.nan) | |||
expected = pd.Series([1, np.nan, 3, np.nan, 4, 5]) | |||
tm.assert_series_equal(expected, result) | |||
|
|||
@pytest.mark.parametrize('to_replace', [pd.NaT, [np.nan, pd.NaT]]) | |||
def test_replace_with_tz_aware_data(self, to_replace): |
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.
can you tests with tz-naive as well, maybe just have a combined test (as we likely have one for naive)
Addressed your comments @jreback and all green. |
thanks @mroeschke had some duplicate whatsnew entries, but fixed |
git diff upstream/master -u -- "*.py" | flake8 --diff
xref #21491, cleaning up older timezone issues and moved the whatsnew entries in the first cleanup PR from v0.23.2 to v0.24.0 as discussed #21491 (comment)