PKGBUILDs/extra/python2/py2-ize-the-CJK-codec-test.patch
2021-03-19 22:08:13 +00:00

47 lines
1.4 KiB
Diff

From ed1aa2f4738efe948242f252bcb0aa0b4314d2a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Fri, 5 Mar 2021 10:34:50 +0100
Subject: py2-ize the CJK codec test
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
Lib/test/multibytecodec_support.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Lib/test/multibytecodec_support.py b/Lib/test/multibytecodec_support.py
index b7d7a3aba7..661ef9ee37 100644
--- a/Lib/test/multibytecodec_support.py
+++ b/Lib/test/multibytecodec_support.py
@@ -2,6 +2,7 @@
# Common Unittest Routines for CJK codecs
#
+import binascii
import codecs
import os
import re
@@ -280,7 +281,7 @@ class TestBase_Mapping(unittest.TestCase):
def _test_mapping_file_plain(self):
def unichrs(s):
- return ''.join(chr(int(x, 16)) for x in s.split('+'))
+ return ''.join(unichr(int(x, 16)) for x in s.split('+'))
urt_wa = {}
@@ -294,7 +295,7 @@ class TestBase_Mapping(unittest.TestCase):
if data[0][:2] != '0x':
self.fail("Invalid line: {line!r}".format(line=line))
- csetch = bytes.fromhex(data[0][2:])
+ csetch = binascii.a2b_hex(data[0][2:])
if len(csetch) == 1 and 0x80 <= csetch[0]:
continue
--
cgit v1.2.3