Kaydet (Commit) ed16bf4a authored tarafından Gregory P. Smith's avatar Gregory P. Smith

assert that the regex given to assertRegex is non-empty.

üst 5317e9cd
......@@ -1121,6 +1121,7 @@ class TestCase(object):
def assertRegex(self, text, expected_regex, msg=None):
"""Fail the test unless the text matches the regular expression."""
if isinstance(expected_regex, (str, bytes)):
assert expected_regex, "expected_regex must not be empty."
expected_regex = re.compile(expected_regex)
if not expected_regex.search(text):
msg = msg or "Regex didn't match"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment