aboutsummaryrefslogtreecommitdiff
path: root/test/helper.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/helper.py')
-rw-r--r--test/helper.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/helper.py b/test/helper.py
index da714078d..d5e0a603e 100644
--- a/test/helper.py
+++ b/test/helper.py
@@ -134,3 +134,17 @@ def expect_info_dict(self, expected_dict, got_dict):
missing_keys,
'Missing keys in test definition: %s' % (
', '.join(sorted(missing_keys))))
+
+
+def assertRegexpMatches(self, text, regexp, msg=None):
+ if hasattr(self, 'assertRegexpMatches'):
+ return self.assertRegexpMatches(text, regexp, msg)
+ else:
+ m = re.match(regexp, text)
+ if not m:
+ note = 'Regexp didn\'t match: %r not found in %r' % (regexp, text)
+ if msg is None:
+ msg = note
+ else:
+ msg = note + ', ' + msg
+ self.assertTrue(m, msg)