Skip to content

Commit d742472

Browse files
Fix tests
1 parent 644ab29 commit d742472

File tree

1 file changed

+17
-34
lines changed

1 file changed

+17
-34
lines changed

Lib/test/datetimetester.py

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,40 +2068,23 @@ class DateSubclass(self.theclass):
20682068
def test_fromisoformat_fails(self):
20692069
# Test that fromisoformat() fails on invalid values
20702070
bad_strs = [
2071-
'', # Empty string
2072-
'\ud800', # bpo-34454: Surrogate code point
2073-
'2009.04-19T03', # Wrong first separator
2074-
'2009-04.19T03', # Wrong second separator
2075-
'2009-04-19T0a', # Invalid hours
2076-
'2009-04-19T03:1a:45', # Invalid minutes
2077-
'2009-04-19T03:15:4a', # Invalid seconds
2078-
'2009-04-19T03;15:45', # Bad first time separator
2079-
'2009-04-19T03:15;45', # Bad second time separator
2080-
'2009-04-19T03:15:4500:00', # Bad time zone separator
2081-
'2009-04-19T03:15:45.123456+24:30', # Invalid time zone offset
2082-
'2009-04-19T03:15:45.123456-24:30', # Invalid negative offset
2083-
'2009-04-10ᛇᛇᛇᛇᛇ12:15', # Unicode chars
2084-
'2009-04\ud80010T12:15', # Surrogate char in date
2085-
'2009-04-10T12\ud80015', # Surrogate char in time
2086-
'2009-04-19T1', # Incomplete hours
2087-
'2009-04-19T12:3', # Incomplete minutes
2088-
'2009-04-19T12:30:4', # Incomplete seconds
2089-
'2009-04-19T12:', # Ends with time separator
2090-
'2009-04-19T12:30:', # Ends with time separator
2091-
'2009-04-19T12:30:45.', # Ends with time separator
2092-
'2009-04-19T12:30:45.123456+', # Ends with timezone separator
2093-
'2009-04-19T12:30:45.123456-', # Ends with timezone separator
2094-
'2009-04-19T12:30:45.123456-05:00a', # Extra text
2095-
'2009-04-19T12:30:45.123-05:00a', # Extra text
2096-
'2009-04-19T12:30:45-05:00a', # Extra text
2097-
'2009-04-19T24:00:00.000001', # Has non-zero microseconds on 24:00
2098-
'2009-04-19T24:00:01.000000', # Has non-zero seconds on 24:00
2099-
'2009-04-19T24:01:00.000000', # Has non-zero minutes on 24:00
2100-
'2009-04-32T24:00:00.000000', # Day is invalid before wrapping due to 24:00
2101-
'2009-13-01T24:00:00.000000', # Month is invalid before wrapping due to 24:00
2102-
'9999-12-31T24:00:00.000000', # Year is invalid after wrapping due to 24:00
2103-
'2009-04-19T12:30Z12:00', # Extra time zone info after Z
2104-
'2009-04-19T12:30:45:334034', # Invalid microsecond separator
2071+
'', # Empty string
2072+
'\ud800', # bpo-34454: Surrogate code point
2073+
'009-03-04', # Not 10 characters
2074+
'123456789', # Not a date
2075+
'200a-12-04', # Invalid character in year
2076+
'2009-1a-04', # Invalid character in month
2077+
'2009-12-0a', # Invalid character in day
2078+
'2009-01-32', # Invalid day
2079+
'2009-02-29', # Invalid leap day
2080+
'2019-W53-1', # No week 53 in 2019
2081+
'2020-W54-1', # No week 54
2082+
'0000-W25-1', # Invalid year
2083+
'10000-W25-1', # Invalid year
2084+
'2020-W25-0', # Invalid day-of-week
2085+
'2020-W25-8', # Invalid day-of-week
2086+
'٢025-03-09' # Unicode characters
2087+
'2009\ud80002\ud80028', # Separators are surrogate codepoints
21052088
]
21062089

21072090
for bad_str in bad_strs:

0 commit comments

Comments
 (0)