diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2010-12-16 19:23:05 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2010-12-16 19:23:05 (GMT) |
commit | ed16bf4aaadd3deaedac8ee36753857b6b8a3492 (patch) | |
tree | 3e05031016e6aecefec1acc9bd3b046307b2a991 /Lib/unittest/case.py | |
parent | 5317e9cd8dc4bf1f02eb9144acb119673d537387 (diff) | |
download | cpython-ed16bf4aaadd3deaedac8ee36753857b6b8a3492.zip cpython-ed16bf4aaadd3deaedac8ee36753857b6b8a3492.tar.gz cpython-ed16bf4aaadd3deaedac8ee36753857b6b8a3492.tar.bz2 |
assert that the regex given to assertRegex is non-empty.
Diffstat (limited to 'Lib/unittest/case.py')
-rw-r--r-- | Lib/unittest/case.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py index 0ad7857..6752e7a 100644 --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -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" |