aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_extractor.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2023-01-11 04:09:19 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2023-01-11 04:09:19 -0500
commit592b077a501be9de956537de94b7b9395bb0fc8b (patch)
treef0700ac4f72afee423caec077f45ac052ffefc9f /test/test_extractor.py
parent7ec7f63b32b70185ef610b31ecd6dc7c0818e109 (diff)
parentfe385c3ff784ba3d19454a35446502c0ec295893 (diff)
Update upstream source from tag 'upstream/1.24.3'
Update to upstream version '1.24.3' with Debian dir 8ae385f7ab48dd765155ada0a9c704f81e159f2c
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():