[Python-checkins] cpython (2.7): Add bigmemtest decorator to test of issue #16335.
serhiy.storchaka
python-checkins at python.org
Mon Jan 21 19:30:05 CET 2013
http://hg.python.org/cpython/rev/ec3a35ab3659
changeset: 81633:ec3a35ab3659
branch: 2.7
parent: 81630:38a10d0778d2
user: Serhiy Storchaka <storchaka at gmail.com>
date: Mon Jan 21 20:23:01 2013 +0200
summary:
Add bigmemtest decorator to test of issue #16335.
files:
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
--- a/Lib/test/test_ucn.py
+++ b/Lib/test/test_ucn.py
@@ -8,6 +8,7 @@
"""#"
import unittest
+import sys
import _testcapi
from test import test_support
@@ -140,18 +141,19 @@
@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():
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list