bpo-30397: Add re.Pattern and re.Match. (#1646)

This commit is contained in:
Serhiy Storchaka 2017-10-04 20:09:49 +03:00 committed by GitHub
parent 8d5a3aad2f
commit 0b5e61ddca
13 changed files with 120 additions and 107 deletions

View file

@ -1596,9 +1596,9 @@ class ReTests(unittest.TestCase):
def test_compile(self):
# Test return value when given string and pattern as parameter
pattern = re.compile('random pattern')
self.assertIsInstance(pattern, re._pattern_type)
self.assertIsInstance(pattern, re.Pattern)
same_pattern = re.compile(pattern)
self.assertIsInstance(same_pattern, re._pattern_type)
self.assertIsInstance(same_pattern, re.Pattern)
self.assertIs(same_pattern, pattern)
# Test behaviour when not given a string or pattern as parameter
self.assertRaises(TypeError, re.compile, 0)