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

Skip to content

Commit 1f1888e

Browse files
committed
Split the bigmem re test in two separate tests with different memory requirements.
1 parent eb0abce commit 1f1888e

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

Lib/test/test_re.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import traceback
88
from weakref import proxy
99

10+
from test.test_bigmem import character_size
11+
12+
1013
# Misc tests from Tim Peters' re.doc
1114

1215
# WARNING: Don't change details in these tests if you don't know
@@ -854,10 +857,17 @@ def test_compile(self):
854857
# Test behaviour when not given a string or pattern as parameter
855858
self.assertRaises(TypeError, re.compile, 0)
856859

860+
@bigmemtest(size=_2G, memuse=character_size)
861+
def test_large_search(self, size):
862+
# Issue #10182: indices were 32-bit-truncated.
863+
s = 'a' * size
864+
m = re.search('$', s)
865+
self.assertIsNotNone(m)
866+
857867
# The huge memuse is because of re.sub() using a list and a join()
858868
# to create the replacement result.
859-
@bigmemtest(size=_2G, memuse=20)
860-
def test_large(self, size):
869+
@bigmemtest(size=_2G, memuse=16 + 2 * character_size)
870+
def test_large_subn(self, size):
861871
# Issue #10182: indices were 32-bit-truncated.
862872
s = 'a' * size
863873
m = re.search('$', s)

0 commit comments

Comments
 (0)