@@ -1338,20 +1338,24 @@ def test_unicode_errors_no_object(self):
1338
1338
self .assertEqual (str (klass .__new__ (klass )), "" )
1339
1339
1340
1340
def test_unicode_error_str_gh_123378 (self ):
1341
- for fn , start , end , obj in product (
1341
+ for formatter , start , end , obj in product (
1342
1342
(str , repr ),
1343
1343
range (- 5 , 5 ),
1344
1344
range (- 5 , 5 ),
1345
1345
('' , 'a' , '123' , '1234' , '12345' , 'abc123' ),
1346
1346
):
1347
- with self .subTest (fn , obj = obj , start = start , end = end ):
1347
+ with self .subTest (formatter , obj = obj , start = start , end = end ):
1348
1348
exc = UnicodeEncodeError ('utf-8' , obj , start , end , '' )
1349
- self .assertIsInstance (fn (exc ), str )
1349
+ self .assertIsInstance (formatter (exc ), str )
1350
+
1351
+ with self .subTest (formatter , obj = obj , start = start , end = end ):
1352
+ exc = UnicodeTranslateError (obj , start , end , '' )
1353
+ self .assertIsInstance (formatter (exc ), str )
1350
1354
1351
1355
encoded = obj .encode ()
1352
- with self .subTest (fn , obj = encoded , start = start , end = end ):
1356
+ with self .subTest (formatter , obj = encoded , start = start , end = end ):
1353
1357
exc = UnicodeDecodeError ('utf-8' , encoded , start , end , '' )
1354
- self .assertIsInstance (fn (exc ), str )
1358
+ self .assertIsInstance (formatter (exc ), str )
1355
1359
1356
1360
@no_tracing
1357
1361
def test_badisinstance (self ):
0 commit comments