aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_extractor.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2023-01-11 04:09:13 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2023-01-11 04:09:13 -0500
commitfe385c3ff784ba3d19454a35446502c0ec295893 (patch)
tree897982793ef2a0c0f349044bf4cf803ccd483e6e /test/test_extractor.py
parentebdfcd3cd3f76534a590ba08933ff7ea54813316 (diff)
New upstream version 1.24.3.upstream/1.24.3
Diffstat (limited to 'test/test_extractor.py')
-rw-r--r--test/test_extractor.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/test/test_extractor.py b/test/test_extractor.py
index de43ff7..144c6f9 100644
--- a/test/test_extractor.py
+++ b/test/test_extractor.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
-# Copyright 2018-2020 Mike Fährmann
+# Copyright 2018-2023 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@@ -96,9 +96,10 @@ class TestExtractorModule(unittest.TestCase):
test_urls = []
# collect testcase URLs
+ append = test_urls.append
for extr in extractor.extractors():
for testcase in extr._get_tests():
- test_urls.append((testcase[0], extr))
+ append((testcase[0], extr))
# iterate over all testcase URLs
for url, extr1 in test_urls:
@@ -114,20 +115,23 @@ class TestExtractorModule(unittest.TestCase):
match = extr2.pattern.match(url)
if match:
- matches.append(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 in matches:
- msg += "\n- "
- msg += match.re.pattern
+ for match, extr in matches:
+ msg += "\n\n- {}:\n{}".format(
+ extr.__name__, match.re.pattern)
self.fail(msg)
- if len(matches) < 1:
+ 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_docstrings(self):
"""ensure docstring uniqueness"""
for extr1 in extractor.extractors():