@@ -2068,22 +2068,40 @@ 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-             '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-             '2009\ud800 02\ud800 28' ,     # Separators are surrogate codepoints 
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\ud800 10T12:15' ,  # Surrogate char in date 
2085+             '2009-04-10T12\ud800 15' ,  # 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 
20872105        ]
20882106
20892107        for  bad_str  in  bad_strs :
@@ -3560,7 +3578,7 @@ def test_fromisoformat_fails_datetime(self):
35603578
35613579        for  bad_str  in  bad_strs :
35623580            with  self .subTest (bad_str = bad_str ):
3563-                 with  self .assertRaises (( ValueError ,  TypeError ) ):
3581+                 with  self .assertRaises (ValueError ):
35643582                    self .theclass .fromisoformat (bad_str )
35653583
35663584    def  test_fromisoformat_fails_datetime_valueerror (self ):
0 commit comments