From c65b0fb4d808606571f084380b030bd8654271a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 22 Jun 2025 11:37:59 +0200 Subject: [PATCH] [tests] remove 'test_unique_pattern_matches' (#7671) no need to explicitly check for extractor pattern overlaps anymore since extractor order (and dict insertion order in general) is preserved since CPython 3.6 --- test/test_extractor.py | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/test/test_extractor.py b/test/test_extractor.py index 4f44188b..4fddc6e4 100644 --- a/test/test_extractor.py +++ b/test/test_extractor.py @@ -141,47 +141,6 @@ class TestExtractorModule(unittest.TestCase): if base not in ("reactor", "wikimedia"): self.assertEqual(extr._cfgpath, ("extractor", cat, sub), url) - @unittest.skipIf(not results, "no test data") - def test_unique_pattern_matches(self): - # collect testcase URLs - test_urls = [] - append = test_urls.append - - for result in results.all(): - if not result.get("#fail"): - append((result["#url"], result["#class"])) - - # iterate over all testcase URLs - for url, extr1 in test_urls: - matches = [] - - # ... and apply all regex patterns to each one - for extr2 in _list_classes(): - - # skip DirectlinkExtractor pattern if it isn't tested - if extr1 != DirectlinkExtractor and \ - extr2 == DirectlinkExtractor: - continue - - match = extr2.pattern.match(url) - if match: - matches.append((match, extr2)) - - # fail if more or less than 1 match happened - if len(matches) > 1: - msg = "'{}' gets matched by more than one pattern:".format(url) - for match, extr in matches: - msg += "\n\n- {}:\n{}".format( - extr.__name__, match.re.pattern) - self.fail(msg) - - elif len(matches) < 1: - msg = "'{}' isn't matched by any pattern".format(url) - self.fail(msg) - - else: - self.assertIs(extr1, matches[0][1], url) - def test_init(self): """Test for exceptions in Extractor.initialize() and .finalize()""" def fail_request(*args, **kwargs):