assertRegexpMatches requires port for python2.5 and python2.6

This commit is contained in:
kelson
2015-08-19 11:30:07 -04:00
parent db5e58e49f
commit 0a79bf3afd
+11
View File
@@ -31,6 +31,17 @@ def setup_clean_session():
class testResponse(unittest.TestCase):
#port from python 2.7, needed for 2.5 and 2.6 tests
def assertRegexpMatches(self, text, expected_regexp, msg=None):
"""Fail the test unless the text matches the regular expression."""
if isinstance(expected_regexp, basestring):
expected_regexp = re.compile(expected_regexp)
if not expected_regexp.search(text):
msg = msg or "Regexp didn't match"
msg = '%s: %r not found in %r' % (
msg, expected_regexp.pattern, text)
raise self.failureException(msg)
def test_include_files(self):
def return_includes(response, extensions=None):