diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-17 13:49:56 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-17 13:49:56 (GMT) |
commit | 2c5e28ebc21b8517cfaa3075dabb81f963be0303 (patch) | |
tree | 987f259bf9152d9554d202f1cae2bd3e236cc69b /Lib/test/test_multibytecodec_support.py | |
parent | b13cacf677c335d43be20675b406923acc1b74a7 (diff) | |
download | cpython-2c5e28ebc21b8517cfaa3075dabb81f963be0303.zip cpython-2c5e28ebc21b8517cfaa3075dabb81f963be0303.tar.gz cpython-2c5e28ebc21b8517cfaa3075dabb81f963be0303.tar.bz2 |
Issue #12057: Fix .hgeol and test_multibytecodec_support for the conversion of
the CJK encoding testcase BLOB into multiple text files.
Diffstat (limited to 'Lib/test/test_multibytecodec_support.py')
-rw-r--r-- | Lib/test/test_multibytecodec_support.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Lib/test/test_multibytecodec_support.py b/Lib/test/test_multibytecodec_support.py index 0639032..9452909 100644 --- a/Lib/test/test_multibytecodec_support.py +++ b/Lib/test/test_multibytecodec_support.py @@ -4,8 +4,11 @@ # Common Unittest Routines for CJK codecs # -import sys, codecs -import unittest, re +import codecs +import os +import re +import sys +import unittest from httplib import HTTPException from test import test_support from StringIO import StringIO @@ -326,6 +329,10 @@ class TestBase_Mapping(unittest.TestCase): self.fail('Decoding failed while testing %s -> %s: %s' % ( repr(csetch), repr(unich), exc.reason)) -def load_teststring(encoding): - from test import cjkencodings_test - return cjkencodings_test.teststring[encoding] +def load_teststring(name): + dir = os.path.join(os.path.dirname(__file__), 'cjkencodings') + with open(os.path.join(dir, name + '.txt'), 'rb') as f: + encoded = f.read() + with open(os.path.join(dir, name + '-utf8.txt'), 'rb') as f: + utf8 = f.read() + return encoded, utf8 |