mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Fix the encodings package codec search function to only search
inside its own package. Fixes problem reported in patch #1433198. Add codec search function for codec test codec.
This commit is contained in:
parent
c3e950cbf3
commit
fe4b34cc4b
3 changed files with 20 additions and 3 deletions
|
@ -11,8 +11,19 @@ Written by Marc-Andre Lemburg (mal@lemburg.com).
|
|||
|
||||
import test.test_support, unittest
|
||||
|
||||
# test codec's full path name (see test/testcodec.py)
|
||||
codecname = 'test.testcodec'
|
||||
import codecs
|
||||
|
||||
# Register a search function which knows about our codec
|
||||
def codec_search_function(encoding):
|
||||
if encoding == 'testcodec':
|
||||
from test import testcodec
|
||||
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 test_constructorx(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue