Add bigmemtest decorator to test of issue #16335.

This commit is contained in:
Serhiy Storchaka 2013-01-21 20:23:01 +02:00
parent b1ecf80e04
commit e3adb43b4b
1 changed files with 13 additions and 11 deletions

View File

@ -8,6 +8,7 @@ Modified for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com)
"""#" """#"
import unittest import unittest
import sys
import _testcapi import _testcapi
from test import test_support from test import test_support
@ -140,18 +141,19 @@ class UnicodeNamesTest(unittest.TestCase):
@unittest.skipUnless(_testcapi.INT_MAX < _testcapi.PY_SSIZE_T_MAX, @unittest.skipUnless(_testcapi.INT_MAX < _testcapi.PY_SSIZE_T_MAX,
"needs UINT_MAX < SIZE_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 # very very long bogus character name
try: x = b'\\N{SPACE' + b'x' * int(_testcapi.UINT_MAX + 1) + b'}'
x = b'\\N{SPACE' + b'x' * int(_testcapi.UINT_MAX + 1) + b'}' self.assertEqual(len(x), len(b'\\N{SPACE}') +
self.assertEqual(len(x), len(b'\\N{SPACE}') + (_testcapi.UINT_MAX + 1))
(_testcapi.UINT_MAX + 1)) self.assertRaisesRegexp(UnicodeError,
self.assertRaisesRegexp(UnicodeError, 'unknown Unicode character name',
'unknown Unicode character name', x.decode, 'unicode-escape'
x.decode, 'unicode-escape' )
)
except MemoryError:
raise unittest.SkipTest("not enough memory")
def test_main(): def test_main():