diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-07 08:06:05 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-07 08:06:05 (GMT) |
commit | 76249ea4a7ab1cb0fa41d967b2fb8975916cb955 (patch) | |
tree | 695ff618fa6667404441dfbb788561f9a0c415a8 /Lib/test/test_ucn.py | |
parent | 6a036793b66683e238c7222eb38368e44127c0e7 (diff) | |
download | cpython-76249ea4a7ab1cb0fa41d967b2fb8975916cb955.zip cpython-76249ea4a7ab1cb0fa41d967b2fb8975916cb955.tar.gz cpython-76249ea4a7ab1cb0fa41d967b2fb8975916cb955.tar.bz2 |
Issue #20532: Tests which use _testcapi now are marked as CPython only.
Diffstat (limited to 'Lib/test/test_ucn.py')
-rw-r--r-- | Lib/test/test_ucn.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Lib/test/test_ucn.py b/Lib/test/test_ucn.py index cba4f07..4409deb 100644 --- a/Lib/test/test_ucn.py +++ b/Lib/test/test_ucn.py @@ -9,10 +9,14 @@ Modified for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com) import unittest import sys -import _testcapi from test import test_support +try: + from _testcapi import INT_MAX, PY_SSIZE_T_MAX, UINT_MAX +except ImportError: + INT_MAX = PY_SSIZE_T_MAX = UINT_MAX = 2**64 - 1 + class UnicodeNamesTest(unittest.TestCase): def checkletter(self, name, code): @@ -139,11 +143,10 @@ class UnicodeNamesTest(unittest.TestCase): unicode, "\\NSPACE", 'unicode-escape', 'strict' ) - @unittest.skipUnless(_testcapi.INT_MAX < _testcapi.PY_SSIZE_T_MAX, - "needs UINT_MAX < SIZE_MAX") - @unittest.skipUnless(_testcapi.UINT_MAX < sys.maxint, - "needs UINT_MAX < sys.maxint") - @test_support.bigmemtest(minsize=_testcapi.UINT_MAX + 1, + @test_support.cpython_only + @unittest.skipUnless(INT_MAX < PY_SSIZE_T_MAX, "needs UINT_MAX < SIZE_MAX") + @unittest.skipUnless(UINT_MAX < sys.maxint, "needs UINT_MAX < sys.maxint") + @test_support.bigmemtest(minsize=UINT_MAX + 1, memuse=2 + 4 // len(u'\U00010000')) def test_issue16335(self, size): func = self.test_issue16335 @@ -151,9 +154,8 @@ class UnicodeNamesTest(unittest.TestCase): raise unittest.SkipTest("not enough memory: %.1fG minimum needed" % (func.minsize * func.memuse / float(1024**3),)) # very very long bogus character name - x = b'\\N{SPACE' + b'x' * int(_testcapi.UINT_MAX + 1) + b'}' - self.assertEqual(len(x), len(b'\\N{SPACE}') + - (_testcapi.UINT_MAX + 1)) + x = b'\\N{SPACE' + b'x' * int(UINT_MAX + 1) + b'}' + self.assertEqual(len(x), len(b'\\N{SPACE}') + (UINT_MAX + 1)) self.assertRaisesRegexp(UnicodeError, 'unknown Unicode character name', x.decode, 'unicode-escape' |