Skip to content

Commit

Permalink
Add tests for 24:00 fromisoformat
Browse files Browse the repository at this point in the history
  • Loading branch information
TizzySaurus committed Jun 17, 2023
1 parent 75ebbc3 commit 311f914
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Lib/test/datetimetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -3259,6 +3259,9 @@ def test_fromisoformat_datetime_examples(self):
('2025-01-02T03:04:05,678+00:00:10',
self.theclass(2025, 1, 2, 3, 4, 5, 678000,
tzinfo=timezone(timedelta(seconds=10)))),
('2025-01-02T24:00:00', self.theclass(2025, 1, 3, 0, 0, 0)),
('2025-01-31T24:00:00', self.theclass(2025, 2, 1, 0, 0, 0)),
('2025-12-31T24:00:00', self.theclass(2026, 1, 1, 0, 0, 0))
]

for input_str, expected in examples:
Expand Down Expand Up @@ -3295,6 +3298,9 @@ def test_fromisoformat_fails_datetime(self):
'2009-04-19T12:30:45.123456-05:00a', # Extra text
'2009-04-19T12:30:45.123-05:00a', # Extra text
'2009-04-19T12:30:45-05:00a', # Extra text
'2009-04-19T24:00:00.000001', # Has non-zero microseconds on 24:00
'2009-04-19T24:00:01.000000', # Has non-zero seconds on 24:00
'2009-04-19T24:01:00.000000', # Has non-zero minutes on 24:00
]

for bad_str in bad_strs:
Expand Down

0 comments on commit 311f914

Please sign in to comment.