+ self.result.append(x)
+
+ def expect_warning(self, regex):
+ # Silence an expected warning matching a regex
+ old_report_warning = self.report_warning
+ def report_warning(self, message):
+ if re.match(regex, message): return
+ old_report_warning(message)
+ self.report_warning = types.MethodType(report_warning, self)
+
+def get_testcases():
+ for ie in youtube_dl.extractor.gen_extractors():
+ t = getattr(ie, '_TEST', None)
+ if t:
+ t['name'] = type(ie).__name__[:-len('IE')]
+ yield t
+ for t in getattr(ie, '_TESTS', []):
+ t['name'] = type(ie).__name__[:-len('IE')]
+ yield t
+
+
+md5 = lambda s: hashlib.md5(s.encode('utf-8')).hexdigest()