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 18
18
except ImportError :
19
19
_testinternalcapi = None
20
20
21
- from test .support import skip_if_buggy_ucrt_strfptime
21
+ from test .support import skip_if_buggy_ucrt_strfptime , SuppressCrashReport
22
22
23
23
# Max year is only limited by the size of C int.
24
24
SIZEOF_INT = sysconfig .get_config_var ('SIZEOF_INT' ) or 4
@@ -182,6 +182,17 @@ def test_strftime(self):
182
182
183
183
self .assertRaises (TypeError , time .strftime , b'%S' , tt )
184
184
185
+ def test_strftime_invalid_format (self ):
186
+ tt = time .gmtime (self .t )
187
+ with SuppressCrashReport ():
188
+ for i in range (1 , 128 ):
189
+ format = ' %' + chr (i )
190
+ with self .subTest (format = format ):
191
+ try :
192
+ time .strftime (format , tt )
193
+ except ValueError as exc :
194
+ self .assertEqual (str (exc ), 'Invalid format string' )
195
+
185
196
def test_strftime_special (self ):
186
197
tt = time .gmtime (self .t )
187
198
s1 = time .strftime ('%c' , tt )
You can’t perform that action at this time.
0 commit comments