aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_codecs.py
diff options
context:
space:
mode:
authorMax Bernstein <tekknolagi@users.noreply.github.com>2020-10-17 13:38:21 -0700
committerGitHub <noreply@github.com>2020-10-17 23:38:21 +0300
commit3635388f52b42e5280229104747962117104c453 (patch)
treec56705fffca5862af09fd72974e66b439491d813 /Lib/test/test_codecs.py
parent975d10a4f8f5d99b01d02fc5f99305a86827f28e (diff)
downloadcpython-3635388f52b42e5280229104747962117104c453.tar.gz
cpython-3635388f52b42e5280229104747962117104c453.zip
bpo-42065: Fix incorrectly formatted _codecs.charmap_decode error message (GH-19940)
Diffstat (limited to 'Lib/test/test_codecs.py')
-rw-r--r--Lib/test/test_codecs.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index 9be8281ce5a..328a47b2e37 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -2197,6 +2197,18 @@ class CharmapTest(unittest.TestCase):
("", len(allbytes))
)
+ self.assertRaisesRegex(TypeError,
+ "character mapping must be in range\\(0x110000\\)",
+ codecs.charmap_decode,
+ b"\x00\x01\x02", "strict", {0: "A", 1: 'Bb', 2: -2}
+ )
+
+ self.assertRaisesRegex(TypeError,
+ "character mapping must be in range\\(0x110000\\)",
+ codecs.charmap_decode,
+ b"\x00\x01\x02", "strict", {0: "A", 1: 'Bb', 2: 999999999}
+ )
+
def test_decode_with_int2int_map(self):
a = ord('a')
b = ord('b')