|
|
|
@ -8,6 +8,7 @@ Modified for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com) |
|
|
|
"""#" |
|
|
|
|
|
|
|
import unittest |
|
|
|
import _testcapi |
|
|
|
|
|
|
|
from test import test_support |
|
|
|
|
|
|
|
@ -137,6 +138,21 @@ class UnicodeNamesTest(unittest.TestCase): |
|
|
|
unicode, "\\NSPACE", 'unicode-escape', 'strict' |
|
|
|
) |
|
|
|
|
|
|
|
@unittest.skipUnless(_testcapi.INT_MAX < _testcapi.PY_SSIZE_T_MAX, |
|
|
|
"needs UINT_MAX < SIZE_MAX") |
|
|
|
def test_issue16335(self): |
|
|
|
# very very long bogus character name |
|
|
|
try: |
|
|
|
x = b'\\N{SPACE' + b'x' * int(_testcapi.UINT_MAX + 1) + b'}' |
|
|
|
except MemoryError: |
|
|
|
raise unittest.SkipTest("not enough memory") |
|
|
|
self.assertEqual(len(x), len(b'\\N{SPACE}') + (_testcapi.UINT_MAX + 1)) |
|
|
|
self.assertRaisesRegex(UnicodeError, |
|
|
|
'unknown Unicode character name', |
|
|
|
x.decode, 'unicode-escape' |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
def test_main(): |
|
|
|
test_support.run_unittest(UnicodeNamesTest) |
|
|
|
|
|
|
|
|