mirror of
https://github.com/python/cpython.git
synced 2025-07-19 01:05:26 +00:00
Issue #12057: Convert CJK encoding testcase BLOB into multiple text files
This commit is contained in:
parent
c77b931196
commit
033a543ab1
27 changed files with 215 additions and 1024 deletions
|
@ -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 test import support
|
||||
from io import BytesIO
|
||||
|
||||
|
@ -342,6 +345,10 @@ class TestBase_Mapping(unittest.TestCase):
|
|||
if (csetch, unich) not in self.pass_dectest:
|
||||
self.assertEqual(str(csetch, self.encoding), unich)
|
||||
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue