def test_blacklist(self): link_uri = "https://example.org/file.jpg" test_uri = "test:" fake_uri = "fake:" self.assertIsInstance(extractor.find(link_uri), DLExtractor) self.assertIsInstance(extractor.find(test_uri), Extractor) self.assertIsNone(extractor.find(fake_uri)) with extractor.blacklist(["directlink"]): self.assertIsNone(extractor.find(link_uri)) self.assertIsInstance(extractor.find(test_uri), Extractor) self.assertIsNone(extractor.find(fake_uri)) with extractor.blacklist([], [DLExtractor, FakeExtractor]): self.assertIsNone(extractor.find(link_uri)) self.assertIsInstance(extractor.find(test_uri), Extractor) self.assertIsNone(extractor.find(fake_uri)) with extractor.blacklist(["test"], [DLExtractor]): self.assertIsNone(extractor.find(link_uri)) self.assertIsNone(extractor.find(test_uri)) self.assertIsNone(extractor.find(fake_uri))