[YoutubeDL] Add simple tests for format_note (Closes #2825)

This commit is contained in:
Philipp Hagemeister 2014-04-30 02:02:41 +02:00
parent e75cafe9fb
commit c57f775710
3 changed files with 67 additions and 47 deletions

View file

@ -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)