X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=inline;f=test%2Fhelper.py;h=d5e0a603e38285109f4892587ccfb9edffcb901d;hb=65157783050b5d2bee55310e084ab4e5e15c2b1b;hp=da714078dafe22021ac084e4bd46b8d5c0fdbfc2;hpb=b9ba5dfa28baa4541016b49eadf74d731dc8936c;p=youtube-dl 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)