File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1414except ImportError :
1515 _testcapi = None
1616
17- from test .support import skip_if_buggy_ucrt_strfptime
17+ from test .support import skip_if_buggy_ucrt_strfptime , SuppressCrashReport
1818
1919# Max year is only limited by the size of C int.
2020SIZEOF_INT = sysconfig .get_config_var ('SIZEOF_INT' ) or 4
@@ -178,6 +178,17 @@ def test_strftime(self):
178178
179179 self .assertRaises (TypeError , time .strftime , b'%S' , tt )
180180
181+ def test_strftime_invalid_format (self ):
182+ tt = time .gmtime (self .t )
183+ with SuppressCrashReport ():
184+ for i in range (1 , 128 ):
185+ format = ' %' + chr (i )
186+ with self .subTest (format = format ):
187+ try :
188+ time .strftime (format , tt )
189+ except ValueError as exc :
190+ self .assertEqual (str (exc ), 'Invalid format string' )
191+
181192 def test_strftime_special (self ):
182193 tt = time .gmtime (self .t )
183194 s1 = time .strftime ('%c' , tt )
You can’t perform that action at this time.
0 commit comments