-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ERR: Raise the correct error for to_datetime() #23969
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 3 commits
d9c1918
f6c1efa
cefb1c1
b3fadc6
399beca
d7adb56
8d8b893
6aa0bf3
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 |
---|---|---|
|
@@ -947,6 +947,14 @@ def test_to_datetime_barely_out_of_bounds(self): | |
with pytest.raises(OutOfBoundsDatetime): | ||
to_datetime(arr) | ||
|
||
def test_to_datetime(self): | ||
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 suspect that we are not properly catching this time data specification mismatch at all. can you see where else we are trying to catch this (prob just put a print statement or something in the cython code to see what tests hit it). 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. Sure. I'm still adding some changes to it. Will notify when ready. 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. @jreback looks like you're right. I don't see any other tests that hit that piece of the cython code. |
||
# GH#23830 raise the correct exception when | ||
# the format argument is passed. | ||
arr = np.array(['2262-04-11 23:47:16.854775808'], dtype=object) | ||
|
||
with pytest.raises(OutOfBoundsDatetime): | ||
to_datetime(arr, format="%Y-%m-%d %H:%M:%S.%f") | ||
|
||
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. Move this out as a separate test and reference the issue number. Also, check the error here with the 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. Thanks for the feedback. I'll move it out. However, my main issue here was that this test would pass locally but fail on the CI build (https://travis-ci.org/pandas-dev/pandas/jobs/460708541). My best guess was that it was due to 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. Your build may not have had this added test, as I'm relatively certain that your change above was not correct. |
||
@pytest.mark.parametrize('cache', [True, False]) | ||
def test_to_datetime_iso8601(self, cache): | ||
result = to_datetime(["2012-01-01 00:00:00"], cache=cache) | ||
|
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 agree this is legit. can you add a comment here about this, e.g. its OOB (even though its just a few lines above)