Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e45dac4

Browse files
Add bigmemtest decorator to test of issue #16335.
1 parent 3b40b71 commit e45dac4

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

Lib/test/test_ucn.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,18 +144,17 @@ def test_strict_error_handling(self):
144144

145145
@unittest.skipUnless(_testcapi.INT_MAX < _testcapi.PY_SSIZE_T_MAX,
146146
"needs UINT_MAX < SIZE_MAX")
147-
def test_issue16335(self):
147+
@support.bigmemtest(size=_testcapi.UINT_MAX + 1,
148+
memuse=1 + 4 // len('\U00010000'), dry_run=False)
149+
def test_issue16335(self, size):
148150
# very very long bogus character name
149-
try:
150-
x = b'\\N{SPACE' + b'x' * (_testcapi.UINT_MAX + 1) + b'}'
151-
self.assertEqual(len(x), len(b'\\N{SPACE}') +
152-
(_testcapi.UINT_MAX + 1))
153-
self.assertRaisesRegex(UnicodeError,
154-
'unknown Unicode character name',
155-
x.decode, 'unicode-escape'
156-
)
157-
except MemoryError:
158-
raise unittest.SkipTest("not enough memory")
151+
x = b'\\N{SPACE' + b'x' * (_testcapi.UINT_MAX + 1) + b'}'
152+
self.assertEqual(len(x), len(b'\\N{SPACE}') +
153+
(_testcapi.UINT_MAX + 1))
154+
self.assertRaisesRegex(UnicodeError,
155+
'unknown Unicode character name',
156+
x.decode, 'unicode-escape'
157+
)
159158

160159

161160
def test_main():

0 commit comments

Comments
 (0)