]> granicus.if.org Git - python/commitdiff
assert that the regex given to assertRegex is non-empty.
authorGregory P. Smith <greg@mad-scientist.com>
Thu, 16 Dec 2010 19:23:05 +0000 (19:23 +0000)
committerGregory P. Smith <greg@mad-scientist.com>
Thu, 16 Dec 2010 19:23:05 +0000 (19:23 +0000)
Lib/unittest/case.py

index 0ad78571b2582bd66af4b12bae478461113d063d..6752e7a895b96fc54c06dcf915f1b5822be1f094 100644 (file)
@@ -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"