Skip to content

Commit

Permalink
Parametrize renamed comic module test
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiX committed Mar 17, 2024
1 parent 32b0dfe commit cfe5738
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions tests/test_comicnames.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2022 Tobias Gruetzmacher
import re
from operator import attrgetter

import pytest

from dosagelib.scraper import scrapers
from dosagelib.plugins import old


class TestComicNames(object):
class TestComicNames:

def test_names(self):
for scraperobj in scrapers.all():
Expand All @@ -20,11 +23,11 @@ def test_names(self):
comicname = name
assert re.sub("[^0-9a-zA-Z_]", "", comicname) == comicname

def test_renamed(self):
for scraperobj in scrapers.all(include_removed=True):
if not isinstance(scraperobj, old.Renamed):
continue
assert len(scraperobj.getDisabledReasons()) > 0
# Renamed scraper should only point to an non-disabled scraper
newscraper = scrapers.find(scraperobj.newname)
assert len(newscraper.getDisabledReasons()) == 0
@pytest.mark.parametrize(('scraperobj'),
[obj for obj in scrapers.all(include_removed=True)
if isinstance(obj, old.Renamed)], ids=attrgetter('name'))
def test_renamed(self, scraperobj):
assert len(scraperobj.getDisabledReasons()) > 0
# Renamed scraper should only point to an non-disabled scraper
newscraper = scrapers.find(scraperobj.newname)
assert len(newscraper.getDisabledReasons()) == 0

0 comments on commit cfe5738

Please sign in to comment.