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

Skip to content

Commit cc50ba2

Browse files
committed
#14179: merge with 3.2.
2 parents a8ec5ea + df723e1 commit cc50ba2

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

Lib/test/test_re.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,16 @@ def test_search_dot_unicode(self):
825825
self.assertIsNotNone(re.search("123.*-", '123\U0010ffff-'))
826826
self.assertIsNotNone(re.search("123.*-", '123\xe9\u20ac\U0010ffff-'))
827827

828+
def test_compile(self):
829+
# Test return value when given string and pattern as parameter
830+
pattern = re.compile('random pattern')
831+
self.assertIsInstance(pattern, re._pattern_type)
832+
same_pattern = re.compile(pattern)
833+
self.assertIsInstance(same_pattern, re._pattern_type)
834+
self.assertIs(same_pattern, pattern)
835+
# Test behaviour when not given a string or pattern as parameter
836+
self.assertRaises(TypeError, re.compile, 0)
837+
828838
def run_re_tests():
829839
from test.re_tests import tests, SUCCEED, FAIL, SYNTAX_ERROR
830840
if verbose:

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,7 @@ Andrii V. Mishkovskyi
687687
Dom Mitchell
688688
Dustin J. Mitchell
689689
Zubin Mithra
690+
Florian Mladitsch
690691
Doug Moen
691692
The Dragon De Monsyne
692693
Skip Montanaro

0 commit comments

Comments
 (0)