Repository navigation
bpo-36004: Add date.fromisocalendar #11888
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
6d323ad
fbab728
925de2f
3ecf02e
e645cd0
86edee5
74fb523
46c6458
28c7fb2
99e75d7
c269a5c
c8444b7
958ffff
3307865
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 |
|---|---|---|
|
|
@@ -1845,6 +1845,24 @@ def test_fromisocalendar_value_errors(self): | |
| with self.assertRaises(ValueError): | ||
| self.theclass.fromisocalendar(*isocal) | ||
|
|
||
| def test_fromisocalendar_type_errors(self): | ||
| isocals = [ | ||
| ("2019", 1, 1), | ||
| (2019, "1", 1), | ||
| (2019, 1, "1"), | ||
| (None, 1, 1), | ||
| (2019, None, 1), | ||
| (2019, 1, None), | ||
| (2019.0, 1, 1), | ||
| (2019, 1.0, 1), | ||
| (2019, 1, 1.0), | ||
| ] | ||
|
Member
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. Would it be possible to use 3 loops to test all combinations, rather than generate these combinations manualy?
Member
Author
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. OK, I've converted it over. I think it's a little harder to understand what's going on in the version where the test cases are generated (compared to manual), but using a loop also has its advantages. |
||
|
|
||
| for isocal in isocals: | ||
| with self.subTest(isocal=isocal): | ||
| with self.assertRaises(TypeError): | ||
| self.theclass.fromisocalendar(*isocal) | ||
|
|
||
|
|
||
| ############################################################################# | ||
| # datetime tests | ||
|
|
||
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.
One thing I'll note is that this is consistent with
datetime.dateitself not accepting floats. I'm not sure how much I agree with that, I just wanted to put it in the tests to ensure consistency between the C and Python versions.