Kaydet (Commit) 2c5e28eb authored tarafından Victor Stinner's avatar Victor Stinner

Issue #12057: Fix .hgeol and test_multibytecodec_support for the conversion of

the CJK encoding testcase BLOB into multiple text files.
üst b13cacf6
...@@ -27,8 +27,9 @@ ...@@ -27,8 +27,9 @@
**.zip = BIN **.zip = BIN
Lib/email/test/data/msg_26.txt = 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/decimaltestdata/*.decTest = BIN
Lib/test/sndhdrdata/sndhdr.* = BIN
# All other files (which presumably are human-editable) are "native". # All other files (which presumably are human-editable) are "native".
# This must be the last rule! # This must be the last rule!
......
...@@ -4,8 +4,11 @@ ...@@ -4,8 +4,11 @@
# Common Unittest Routines for CJK codecs # Common Unittest Routines for CJK codecs
# #
import sys, codecs import codecs
import unittest, re import os
import re
import sys
import unittest
from httplib import HTTPException from httplib import HTTPException
from test import test_support from test import test_support
from StringIO import StringIO from StringIO import StringIO
...@@ -326,6 +329,10 @@ class TestBase_Mapping(unittest.TestCase): ...@@ -326,6 +329,10 @@ class TestBase_Mapping(unittest.TestCase):
self.fail('Decoding failed while testing %s -> %s: %s' % ( self.fail('Decoding failed while testing %s -> %s: %s' % (
repr(csetch), repr(unich), exc.reason)) repr(csetch), repr(unich), exc.reason))
def load_teststring(encoding): def load_teststring(name):
from test import cjkencodings_test dir = os.path.join(os.path.dirname(__file__), 'cjkencodings')
return cjkencodings_test.teststring[encoding] 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment