mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-30397: Add re.Pattern and re.Match. (#1646)
This commit is contained in:
parent
8d5a3aad2f
commit
0b5e61ddca
13 changed files with 120 additions and 107 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue