File site_generators_tests.py
has 1915 lines of code (exceeds 900 allowed). Consider refactoring. Open
#!/usr/bin/env python3
"""Tests for generators of the site module."""
#
# (C) Pywikibot team, 2008-2024
#
TestSiteGenerators
has 34 functions (exceeds 30 allowed). Consider refactoring. Open
class TestSiteGenerators(DefaultSiteTestCase):
"""Test cases for Site methods."""
cached = True
Function test_blocks
has a Cognitive Complexity of 21 (exceeds 10 allowed). Consider refactoring. Open
def test_blocks(self):
"""Test the site.blocks() method."""
mysite = self.get_site()
props = ('id', 'by', 'timestamp', 'expiry', 'reason')
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function test_watchlist_revs
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def test_watchlist_revs(self):
"""Test the site.watchlist_revs() method."""
mysite = self.get_site()
wl = list(mysite.watchlist_revs(total=10))
self.assertLessEqual(len(wl), 10)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function test_search
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def test_search(self):
"""Test the site.search() method."""
mysite = self.site
try:
se = list(mysite.search('wiki', total=100, namespaces=0))
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function test_pages_with_property
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def test_pages_with_property(self):
"""Test pages_with_property method."""
mysite = self.get_site()
pnames = mysite.get_property_names()
for item in ('defaultsort', 'disambiguation', 'displaytitle',
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function test_logevents
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def test_logevents(self):
"""Test logevents method."""
mysite = self.get_site()
le = list(mysite.logevents(total=10))
self.assertLessEqual(len(le), 10)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
TODO found Open
# TODO test other optional arguments
- Exclude checks