@@ -1338,20 +1338,24 @@ def test_unicode_errors_no_object(self):
13381338 self .assertEqual (str (klass .__new__ (klass )), "" )
13391339
13401340 def test_unicode_error_str_gh_123378 (self ):
1341- for fn , start , end , obj in product (
1341+ for formatter , start , end , obj in product (
13421342 (str , repr ),
13431343 range (- 5 , 5 ),
13441344 range (- 5 , 5 ),
13451345 ('' , 'a' , '123' , '1234' , '12345' , 'abc123' ),
13461346 ):
1347- with self .subTest (fn , obj = obj , start = start , end = end ):
1347+ with self .subTest (formatter , obj = obj , start = start , end = end ):
13481348 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 )
13501354
13511355 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 ):
13531357 exc = UnicodeDecodeError ('utf-8' , encoded , start , end , '' )
1354- self .assertIsInstance (fn (exc ), str )
1358+ self .assertIsInstance (formatter (exc ), str )
13551359
13561360 @no_tracing
13571361 def test_badisinstance (self ):
0 commit comments