Skip to content

Commit 04317fc

Browse files
committed
PR comments on the resize test
1 parent 920cc2b commit 04317fc

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎Lib/test/test_bytes.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import textwrap
1919
import threading
2020
import unittest
21+
from _codecs import _unregister_error as _codecs_unregister_error
2122

2223
import test.support
2324
from test import support
@@ -2203,13 +2204,14 @@ def handler(exc):
22032204
self.assertRaises(BufferError, b.clear)
22042205
self.assertRaises(BufferError, b.append, 0)
22052206
return ('?', exc.end)
2207+
self.addCleanup(_codecs_unregister_error, 'test.bytearray_decode_resize')
22062208
codecs.register_error('test.bytearray_decode_resize', handler)
22072209
for encoding in 'utf-8', 'utf-8-sig':
22082210
with self.subTest(encoding=encoding):
22092211
self.assertEqual(
22102212
b.decode(encoding, 'test.bytearray_decode_resize'),
22112213
'ab?cd')
2212-
self.assertEqual(b, b'ab\xffcd')
2214+
self.assertEqual(b, b'ab\xffcd')
22132215

22142216
def test_decode_subclass_buffer(self):
22152217
# decode() decodes the buffer that the object exports.

0 commit comments

Comments
 (0)