-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
WIP: bpo-1100942: Add datetime.time.strptime and datetime.date.strptime #5578
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 1 commit
ad5ffab
50606eb
ab5030f
07fb326
010ac8b
5b58fc1
8353a65
cff74a9
f92a799
4c4a7cc
b006172
ff7487f
a048f0e
9ac0af4
a952bb7
412aea2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1031,6 +1031,8 @@ def test_strptime_valid_format(self): | |
def test_strptime_invalid_format(self): | ||
tests = [ | ||
('2004-12-01 13:02:47.197', '%Y-%m-%d %H:%M:%S.%f'), | ||
('2018-01-01 00:00', '%Y-%m-%d %H:%M'), | ||
('2018-01-01', ''), | ||
('01', '%M'), | ||
('02', '%H'), | ||
] | ||
|
@@ -3132,6 +3134,8 @@ def test_strptime_invalid(self): | |
tests = [ | ||
('2004-12-01 13:02:47.197', '%Y-%m-%d %H:%M:%S.%f'), | ||
('2004-12-01', '%Y-%m-%d'), | ||
('1900-01-01 12:30', '%Y-%m-%d %H:%M'), | ||
('12:30:15', '') | ||
] | ||
for date_string, date_format in tests: | ||
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 think it would be good to use Also, per the other comment I guess you need to add something like 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 think you need two more test cases: ('1900-01-01 12:30', '%Y-%m-%d %H:%M'),
('12:30:15', ''),
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. the test with For the other test, yep, there is an issue. 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. The fact that it doesn't raise an exception is an issue. I'm a bit surprised that it doesn't raise an exception on pure Python, that's a bug, because I'm pretty sure that:
|
||
with self.subTest(date_string=date_string, date_format=date_format): | ||
|
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.
This needs at least two more test cases:
Both should fail.