-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: DTI/TDI .insert accepting incorrectly-dtyped NaT #30754
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
Conversation
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.
some followon comments
@@ -317,7 +317,9 @@ def test_take_fill_value_with_timezone(self): | |||
|
|||
|
|||
class TestDatetimeIndex: | |||
@pytest.mark.parametrize("null", [None, np.nan, pd.NaT]) | |||
@pytest.mark.parametrize( | |||
"null", [None, np.nan, np.datetime64("NaT"), pd.NaT, pd.NA] |
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.
should create a fixture like this (similar to nulls_fixture), but this is more datetime specialized, but for another pass.
@@ -326,6 +328,12 @@ def test_insert_nat(self, tz, null): | |||
res = idx.insert(0, null) | |||
tm.assert_index_equal(res, expected) | |||
|
|||
@pytest.mark.parametrize("tz", [None, "UTC", "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.
try to fixturize at some point (the tzs)
@@ -219,11 +219,29 @@ def test_insert(self): | |||
assert result.name == expected.name | |||
assert result.freq == expected.freq | |||
|
|||
@pytest.mark.parametrize( | |||
"null", [None, np.nan, np.timedelta64("NaT"), pd.NaT, pd.NA] |
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.
similar to above
thanks (technically should have a whatsnew, but this is a very very tiny edge case), but if you can in a followon ok. |
Also TDI.insert trying to parse strings to Timedelta, which neither DTI nor PI do.