You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2019-05-18.19:46:43.829>labels= ['tests', '3.8', 'library']
title='ISO date errors in _strptime are jumbled'updated_at=<Date2019-05-19.01:10:45.613>user='https://github.com/GPHemsley'
@gphelmsley Can you clarify what you mean by this?
Do you have a minimal reproducing example that shows what's happening and what you are expecting?
GPHemsley commented on May 18, 2019
GPHemsleymannequin
MannequinAuthor
More actions
I've created a PR that fixes the issue, which I discovered while evaluating the test coverage for _strptime.
Certain scenarios of error messages were never being hit because the cascade was out of order, and the tests were not showing that because they were throwing a different ValueError than the one they were expecting to throw.
Hm, I was a bit confused by your wording here, because I am able to trigger all the errors just fine even before this PR, but I do think that even though this isn't necessarily fixing inaccurate error messages (all the error messages *are* accurate), you're right that the text of the messages does seem to indicate that the original authors intended a cascade ordering more like the one you've proposed.
I'll give this a more thorough review a bit later, thanks for working on this!
GPHemsley commented on May 19, 2019
GPHemsleymannequin
MannequinAuthor
More actions
Ah yes, to be clear, I wasn't trying to suggest that the error messages themselves were wrong—just that they weren't triggering when the tests were expecting them to.
Some of the existing tests currently trigger the "unconverted data remains" ValueError from earlier in the method, but because the messages are not checked, that is not immediately obvious. I've also added new tests for additional scenarios that would presumably also be considered invalid, based on the existing ones.
_strptime('1999 256', '%G %j'):
was "ISO year directive '%G' must be used with the ISO week directive '%V' and a weekday directive ('%A', '%a', '%w', or '%u')."
proposed "Day of the year directive '%j' is not compatible with ISO year directive '%G'. Use '%Y' instead."
_strptime('50 5', '%V %u'):
was "ISO week directive '%V' is incompatible with the year directive '%Y'. Use the ISO year '%G' instead."
proposed "ISO week directive '%V' must be used with the ISO year directive '%G' and a weekday directive ('%A', '%a', '%w', or '%u')."
In both cases the former message refers to a directive that does not appear in the format string.
Activity
GPHemsley commentedon May 18, 2019
This has not been apparent because the tests for this code are not testing what they think they're testing.
pganssle commentedon May 18, 2019
@gphelmsley Can you clarify what you mean by this?
Do you have a minimal reproducing example that shows what's happening and what you are expecting?
GPHemsley commentedon May 18, 2019
I've created a PR that fixes the issue, which I discovered while evaluating the test coverage for _strptime.
Certain scenarios of error messages were never being hit because the cascade was out of order, and the tests were not showing that because they were throwing a different ValueError than the one they were expecting to throw.
pganssle commentedon May 18, 2019
Hm, I was a bit confused by your wording here, because I am able to trigger all the errors just fine even before this PR, but I do think that even though this isn't necessarily fixing inaccurate error messages (all the error messages *are* accurate), you're right that the text of the messages does seem to indicate that the original authors intended a cascade ordering more like the one you've proposed.
I'll give this a more thorough review a bit later, thanks for working on this!
GPHemsley commentedon May 19, 2019
Ah yes, to be clear, I wasn't trying to suggest that the error messages themselves were wrong—just that they weren't triggering when the tests were expecting them to.
Some of the existing tests currently trigger the "unconverted data remains" ValueError from earlier in the method, but because the messages are not checked, that is not immediately obvious. I've also added new tests for additional scenarios that would presumably also be considered invalid, based on the existing ones.
serhiy-storchaka commentedon Dec 26, 2023
There are two changes in test results:
_strptime('1999 256', '%G %j'):was "ISO year directive '%G' must be used with the ISO week directive '%V' and a weekday directive ('%A', '%a', '%w', or '%u')."
proposed "Day of the year directive '%j' is not compatible with ISO year directive '%G'. Use '%Y' instead."
_strptime('50 5', '%V %u'):was "ISO week directive '%V' is incompatible with the year directive '%Y'. Use the ISO year '%G' instead."
proposed "ISO week directive '%V' must be used with the ISO year directive '%G' and a weekday directive ('%A', '%a', '%w', or '%u')."
In both cases the former message refers to a directive that does not appear in the format string.
serhiy-storchaka commentedon Dec 26, 2023
I consider this as a bug.
serhiy-storchaka commentedon Dec 26, 2023
Thank you for your contribution @GPHemsley. Sorry for the delay.