File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 14
14
except ImportError :
15
15
_testcapi = None
16
16
17
- from test .support import skip_if_buggy_ucrt_strfptime
17
+ from test .support import skip_if_buggy_ucrt_strfptime , SuppressCrashReport
18
18
19
19
# Max year is only limited by the size of C int.
20
20
SIZEOF_INT = sysconfig .get_config_var ('SIZEOF_INT' ) or 4
@@ -178,6 +178,17 @@ def test_strftime(self):
178
178
179
179
self .assertRaises (TypeError , time .strftime , b'%S' , tt )
180
180
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
+
181
192
def test_strftime_special (self ):
182
193
tt = time .gmtime (self .t )
183
194
s1 = time .strftime ('%c' , tt )
You can’t perform that action at this time.
0 commit comments