diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-10-04 17:09:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-04 17:09:49 (GMT) |
commit | 0b5e61ddca73ad4fe597fb15065115b0285c8849 (patch) | |
tree | 67819288e77e0c1835ab7e04af83f741e77cfea8 /Lib/test | |
parent | 8d5a3aad2f805dc0ea40829b751f58aa6c75305d (diff) | |
download | cpython-0b5e61ddca73ad4fe597fb15065115b0285c8849.zip cpython-0b5e61ddca73ad4fe597fb15065115b0285c8849.tar.gz cpython-0b5e61ddca73ad4fe597fb15065115b0285c8849.tar.bz2 |
bpo-30397: Add re.Pattern and re.Match. (#1646)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_optparse.py | 4 | ||||
-rw-r--r-- | Lib/test/test_re.py | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py index 91a0319..437fdd2 100644 --- a/Lib/test/test_optparse.py +++ b/Lib/test/test_optparse.py @@ -24,8 +24,6 @@ from optparse import make_option, Option, \ from optparse import _match_abbrev from optparse import _parse_num -retype = type(re.compile('')) - class InterceptedError(Exception): def __init__(self, error_message=None, @@ -107,7 +105,7 @@ Args were %(args)s.""" % locals ()) func(*args, **kwargs) except expected_exception as err: actual_message = str(err) - if isinstance(expected_message, retype): + if isinstance(expected_message, re.Pattern): self.assertTrue(expected_message.search(actual_message), """\ expected exception message pattern: diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index e9c07a0..9cb426a 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -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) |