summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unicode.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-03-01 20:30:30 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-03-01 20:30:30 (GMT)
commit6c9aa8f2bf46e28de74ce11d85bcd448c0d0d529 (patch)
treed60ac5d1a1c8210af5403fd948a68f802b8ba35f /Lib/test/test_unicode.py
parentbb0dbd583bdac8f1bfb9f0a45e7014b2663d5729 (diff)
downloadcpython-6c9aa8f2bf46e28de74ce11d85bcd448c0d0d529.zip
cpython-6c9aa8f2bf46e28de74ce11d85bcd448c0d0d529.tar.gz
cpython-6c9aa8f2bf46e28de74ce11d85bcd448c0d0d529.tar.bz2
Fix str.translate()
Issue #26464: Fix str.translate() when string is ASCII and first replacements removes character, but next replacement uses a non-ASCII character or a string longer than 1 character. Regression introduced in Python 3.5.0.
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r--Lib/test/test_unicode.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index fac8b7b..b258db1 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -347,6 +347,10 @@ class UnicodeTest(string_tests.CommonTest,
"[a]")
self.assertEqual("[\xe9]".translate(str.maketrans({'\xe9': None})),
"[]")
+ self.assertEqual('axb'.translate(str.maketrans({'a': None, 'b': '123'})),
+ "x123")
+ self.assertEqual('axb'.translate(str.maketrans({'a': None, 'b': '\xe9'})),
+ "x\xe9")
# invalid Unicode characters
invalid_char = 0x10ffff+1