summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unicode.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-11-25 19:09:01 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-11-25 19:09:01 (GMT)
commit6345be9a141642c2e95eec417844f8702775b700 (patch)
tree5cfa88e01498c964c857ca184f7010924e69de25 /Lib/test/test_unicode.py
parente7ede067576e9beaf0787e1fb3104cf6202d8aa0 (diff)
downloadcpython-6345be9a141642c2e95eec417844f8702775b700.zip
cpython-6345be9a141642c2e95eec417844f8702775b700.tar.gz
cpython-6345be9a141642c2e95eec417844f8702775b700.tar.bz2
Close #13093: PyUnicode_EncodeDecimal() doesn't support error handlers
different than "strict" anymore. The caller was unable to compute the size of the output buffer: it depends on the error handler.
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r--Lib/test/test_unicode.py18
1 files changed, 4 insertions, 14 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index b20f878..72aae8f 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -1816,20 +1816,10 @@ class UnicodeTest(string_tests.CommonTest,
b' 3.14 ')
self.assertRaises(UnicodeEncodeError,
unicode_encodedecimal, "123\u20ac", "strict")
- self.assertEqual(unicode_encodedecimal("123\u20ac", "replace"),
- b'123?')
- self.assertEqual(unicode_encodedecimal("123\u20ac", "ignore"),
- b'123')
- self.assertEqual(unicode_encodedecimal("123\u20ac", "xmlcharrefreplace"),
- b'123&#8364;')
- self.assertEqual(unicode_encodedecimal("123\u20ac", "backslashreplace"),
- b'123\\u20ac')
- self.assertEqual(unicode_encodedecimal("123\u20ac\N{EM SPACE}", "replace"),
- b'123? ')
- self.assertEqual(unicode_encodedecimal("123\u20ac\u20ac", "replace"),
- b'123??')
- self.assertEqual(unicode_encodedecimal("123\u20ac\u0660", "replace"),
- b'123?0')
+ self.assertRaisesRegex(
+ ValueError,
+ "^'decimal' codec can't encode character",
+ unicode_encodedecimal, "123\u20ac", "replace")
def test_transform_decimal(self):
from _testcapi import unicode_transformdecimaltoascii as transform_decimal