mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-41919, test_codecs: Move codecs.register calls to setUp() (GH-22513)
* Move the codecs' (un)register operation to testcases. * Remove _codecs._forget_codec() and _PyCodec_Forget()
This commit is contained in:
parent
cf693e537d
commit
c9f696cb96
7 changed files with 16 additions and 112 deletions
|
@ -20,12 +20,15 @@ def codec_search_function(encoding):
|
|||
return tuple(testcodec.getregentry())
|
||||
return None
|
||||
|
||||
codecs.register(codec_search_function)
|
||||
|
||||
# test codec's name (see test/testcodec.py)
|
||||
codecname = 'testcodec'
|
||||
|
||||
class CharmapCodecTest(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
codecs.register(codec_search_function)
|
||||
self.addCleanup(codecs.unregister, codec_search_function)
|
||||
|
||||
def test_constructorx(self):
|
||||
self.assertEqual(str(b'abc', codecname), 'abc')
|
||||
self.assertEqual(str(b'xdef', codecname), 'abcdef')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue