diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-21 18:23:01 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-21 18:23:01 (GMT) |
commit | e3adb43b4b99804622cc065e1c6b5e2494f6190a (patch) | |
tree | dacb8568f085dd6f866179de4664a372f3366a2e | |
parent | b1ecf80e04f497ee6bbdef0728389e256726036c (diff) | |
download | cpython-e3adb43b4b99804622cc065e1c6b5e2494f6190a.zip cpython-e3adb43b4b99804622cc065e1c6b5e2494f6190a.tar.gz cpython-e3adb43b4b99804622cc065e1c6b5e2494f6190a.tar.bz2 |
Add bigmemtest decorator to test of issue #16335.
-rw-r--r-- | Lib/test/test_ucn.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/Lib/test/test_ucn.py b/Lib/test/test_ucn.py index 6902544..b833134 100644 --- a/Lib/test/test_ucn.py +++ b/Lib/test/test_ucn.py @@ -8,6 +8,7 @@ Modified for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com) """#" import unittest +import sys import _testcapi from test import test_support @@ -140,18 +141,19 @@ class UnicodeNamesTest(unittest.TestCase): @unittest.skipUnless(_testcapi.INT_MAX < _testcapi.PY_SSIZE_T_MAX, "needs UINT_MAX < SIZE_MAX") - def test_issue16335(self): + @unittest.skipUnless(_testcapi.UINT_MAX < sys.maxint, + "needs UINT_MAX < sys.maxint") + @test_support.bigmemtest(minsize=_testcapi.UINT_MAX + 1, + memuse=1 + 4 // len(u'\U00010000')) + def test_issue16335(self, size): # very very long bogus character name - try: - x = b'\\N{SPACE' + b'x' * int(_testcapi.UINT_MAX + 1) + b'}' - self.assertEqual(len(x), len(b'\\N{SPACE}') + - (_testcapi.UINT_MAX + 1)) - self.assertRaisesRegexp(UnicodeError, - 'unknown Unicode character name', - x.decode, 'unicode-escape' - ) - except MemoryError: - raise unittest.SkipTest("not enough memory") + x = b'\\N{SPACE' + b'x' * int(_testcapi.UINT_MAX + 1) + b'}' + self.assertEqual(len(x), len(b'\\N{SPACE}') + + (_testcapi.UINT_MAX + 1)) + self.assertRaisesRegexp(UnicodeError, + 'unknown Unicode character name', + x.decode, 'unicode-escape' + ) def test_main(): |