]> granicus.if.org Git - python/commitdiff
Issue #12057: Fix .hgeol and test_multibytecodec_support for the conversion of
authorVictor Stinner <victor.stinner@haypocalc.com>
Tue, 17 May 2011 13:49:56 +0000 (15:49 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Tue, 17 May 2011 13:49:56 +0000 (15:49 +0200)
the CJK encoding testcase BLOB into multiple text files.

.hgeol
Lib/test/test_multibytecodec_support.py

diff --git a/.hgeol b/.hgeol
index e1c19926a8f4b2940a17d026f124a0d1439dfdfd..fe666055d30d22bb262856fb1ec5eefcde12a88c 100644 (file)
--- a/.hgeol
+++ b/.hgeol
@@ -27,8 +27,9 @@
 **.zip  = BIN
 
 Lib/email/test/data/msg_26.txt = BIN
-Lib/test/sndhdrdata/sndhdr.* = BIN
+Lib/test/cjkencodings/* = BIN
 Lib/test/decimaltestdata/*.decTest = BIN
+Lib/test/sndhdrdata/sndhdr.* = BIN
 
 # All other files (which presumably are human-editable) are "native".
 # This must be the last rule!
index 0639032a2dd475efb7522e89a3633e81173e40a5..94529096d2f792ba0fb9b1bcf6ef61a6b82ccff0 100644 (file)
@@ -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