diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-11-13 19:23:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-13 19:23:48 (GMT) |
commit | 9b6c60cbce4ac45e8ccd7934babff465e9769509 (patch) | |
tree | 973d37d42dfe1ce66303ad0cf658bb20870aa88e /Lib/test/test_unicode.py | |
parent | ce12629c84400c52734859e43b2386deb2b6da12 (diff) | |
download | cpython-9b6c60cbce4ac45e8ccd7934babff465e9769509.zip cpython-9b6c60cbce4ac45e8ccd7934babff465e9769509.tar.gz cpython-9b6c60cbce4ac45e8ccd7934babff465e9769509.tar.bz2 |
bpo-31979: Simplify transforming decimals to ASCII (#4336)
in int(), float() and complex() parsers.
This also speeds up parsing non-ASCII numbers by around 20%.
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r-- | Lib/test/test_unicode.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 341007b..2b77863 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -2068,11 +2068,14 @@ class UnicodeTest(string_tests.CommonTest, # Error handling (wrong arguments) self.assertRaises(TypeError, "hello".encode, 42, 42, 42) - # Error handling (lone surrogate in PyUnicode_TransformDecimalToASCII()) - self.assertRaises(UnicodeError, float, "\ud800") - self.assertRaises(UnicodeError, float, "\udf00") - self.assertRaises(UnicodeError, complex, "\ud800") - self.assertRaises(UnicodeError, complex, "\udf00") + # Error handling (lone surrogate in + # _PyUnicode_TransformDecimalAndSpaceToASCII()) + self.assertRaises(ValueError, int, "\ud800") + self.assertRaises(ValueError, int, "\udf00") + self.assertRaises(ValueError, float, "\ud800") + self.assertRaises(ValueError, float, "\udf00") + self.assertRaises(ValueError, complex, "\ud800") + self.assertRaises(ValueError, complex, "\udf00") def test_codecs(self): # Encoding |