else:
tests = getattr(ie, '_TESTS', [])
for t in tests:
- if not include_onlymatching and getattr(t, 'only_matching', False):
+ if not include_onlymatching and t.get('only_matching', False):
continue
t['name'] = type(ie).__name__[:-len('IE')]
yield t
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)