Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 311f914

Browse files
committed
Add tests for 24:00 fromisoformat
1 parent 75ebbc3 commit 311f914

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Lib/test/datetimetester.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3259,6 +3259,9 @@ def test_fromisoformat_datetime_examples(self):
32593259
('2025-01-02T03:04:05,678+00:00:10',
32603260
self.theclass(2025, 1, 2, 3, 4, 5, 678000,
32613261
tzinfo=timezone(timedelta(seconds=10)))),
3262+
('2025-01-02T24:00:00', self.theclass(2025, 1, 3, 0, 0, 0)),
3263+
('2025-01-31T24:00:00', self.theclass(2025, 2, 1, 0, 0, 0)),
3264+
('2025-12-31T24:00:00', self.theclass(2026, 1, 1, 0, 0, 0))
32623265
]
32633266

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

33003306
for bad_str in bad_strs:

0 commit comments

Comments
 (0)