From 0a79bf3afd3f9013af78e9d55ec0b73a16d5b000 Mon Sep 17 00:00:00 2001 From: kelson Date: Wed, 19 Aug 2015 11:30:07 -0400 Subject: [PATCH] assertRegexpMatches requires port for python2.5 and python2.6 --- gluon/tests/test_globals.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gluon/tests/test_globals.py b/gluon/tests/test_globals.py index 8ba6d4f0..a132985f 100644 --- a/gluon/tests/test_globals.py +++ b/gluon/tests/test_globals.py @@ -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):