mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +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
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue