From c57f7757101690681af2eb8c40c8bf81bbe6e64f Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Wed, 30 Apr 2014 02:02:41 +0200 Subject: [YoutubeDL] Add simple tests for format_note (Closes #2825) --- test/helper.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/helper.py') 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) -- cgit v1.2.3