[Python-checkins] r87327 - python/branches/py3k/Lib/unittest/case.py
gregory.p.smith
python-checkins at python.org
Thu Dec 16 20:23:05 CET 2010
Author: gregory.p.smith
Date: Thu Dec 16 20:23:05 2010
New Revision: 87327
Log:
assert that the regex given to assertRegex is non-empty.
Modified:
python/branches/py3k/Lib/unittest/case.py
Modified: python/branches/py3k/Lib/unittest/case.py
==============================================================================
--- python/branches/py3k/Lib/unittest/case.py (original)
+++ python/branches/py3k/Lib/unittest/case.py Thu Dec 16 20:23:05 2010
@@ -1121,6 +1121,7 @@
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"
More information about the Python-checkins
mailing list