diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2010-12-16 19:23:05 +0000 |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2010-12-16 19:23:05 +0000 |
commit | 4e6bffa524db8282e700212861eb82621eb16ee9 (patch) | |
tree | 4c46801ea9ca5ad0126b2ae0852e6a412885ced2 /Lib/unittest | |
parent | c8bb681b3e6685daaee50df60c4c0ff11d4e03f0 (diff) | |
download | cpython-4e6bffa524db8282e700212861eb82621eb16ee9.tar.gz |
assert that the regex given to assertRegex is non-empty.
Diffstat (limited to 'Lib/unittest')
-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 0ad78571b2..6752e7a895 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" |