summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/api/test_comic.py8
-rw-r--r--tests/api/test_db.py8
-rw-r--r--tests/scrapers/test_scraper.py2
-rw-r--r--tests/scrapers/test_scraper_utils.py16
4 files changed, 17 insertions, 17 deletions
diff --git a/tests/api/test_comic.py b/tests/api/test_comic.py
index 8555a5a..dcc5822 100644
--- a/tests/api/test_comic.py
+++ b/tests/api/test_comic.py
@@ -1097,7 +1097,7 @@ async def test_upsert_comic_tags_uses_existing(upsert_comics, empty_comic):
@pytest.mark.parametrize(
- "key,list",
+ "key,items",
[
("artists", ["arty", "farty"]),
("tags", ["alien:medium", "human:tiny"]),
@@ -1116,11 +1116,11 @@ async def test_upsert_comic_tags_uses_existing(upsert_comics, empty_comic):
],
)
@pytest.mark.anyio
-async def test_upsert_comic_creates(upsert_comics, empty_comic, key, list):
+async def test_upsert_comic_creates(upsert_comics, empty_comic, key, items):
original_comic = await DB.add(empty_comic)
input = {
- key: {"names": list, "options": {"onMissing": "CREATE"}},
+ key: {"names": items, "options": {"onMissing": "CREATE"}},
}
response = Response(await upsert_comics(original_comic.id, input))
response.assert_is("UpsertSuccess")
@@ -1128,7 +1128,7 @@ async def test_upsert_comic_creates(upsert_comics, empty_comic, key, list):
comic = await DB.get(Comic, original_comic.id, full=True)
assert comic is not None
- assert set(list) == set([o.name for o in getattr(comic, key)])
+ assert set(items) == set([o.name for o in getattr(comic, key)])
@pytest.mark.anyio
diff --git a/tests/api/test_db.py b/tests/api/test_db.py
index 1405c23..b030035 100644
--- a/tests/api/test_db.py
+++ b/tests/api/test_db.py
@@ -67,8 +67,8 @@ async def test_models_retained_when_clearing_association(
comic = await DB.add(comic)
async with database.session() as s:
- object = await s.get(Comic, comic.id)
- setattr(object, key, [])
+ obj = await s.get(Comic, comic.id)
+ setattr(obj, key, [])
await s.commit()
assert await DB.get(assoccls, (comic.id, model.id)) is None
@@ -87,8 +87,8 @@ async def test_models_retained_when_clearing_comictag(empty_comic):
await DB.add(ct)
async with database.session() as s:
- object = await s.get(Comic, comic.id)
- object.tags = []
+ obj = await s.get(Comic, comic.id)
+ obj.tags = []
await s.commit()
assert await DB.get(ComicTag, (comic.id, ct.namespace_id, ct.tag_id)) is None
diff --git a/tests/scrapers/test_scraper.py b/tests/scrapers/test_scraper.py
index 8492425..d0cef7b 100644
--- a/tests/scrapers/test_scraper.py
+++ b/tests/scrapers/test_scraper.py
@@ -20,7 +20,7 @@ class NoneScraper(Scraper):
class WarningScraper(Scraper):
is_available = True
- def warn(self, str):
+ def warn(self, msg):
raise ScrapeWarning("Invalid input")
def scrape(self):
diff --git a/tests/scrapers/test_scraper_utils.py b/tests/scrapers/test_scraper_utils.py
index 4b02aad..30b9796 100644
--- a/tests/scrapers/test_scraper_utils.py
+++ b/tests/scrapers/test_scraper_utils.py
@@ -8,23 +8,23 @@ from hircine.scraper.utils import open_archive_file, parse_dict
def test_parse_dict():
- dict = {
+ data = {
"scalar": "foo",
"list": ["bar", "baz"],
"dict": {"nested_scalar": "qux", "nested_list": ["plugh", "xyzzy"]},
}
- def id(type):
- return lambda item: f"{type}_{item}"
+ def annotate(tag):
+ return lambda item: f"{tag}_{item}"
parsers = {
- "scalar": id("scalar"),
- "list": id("list"),
- "dict": {"nested_scalar": id("scalar"), "nested_list": id("list")},
- "missing": id("missing"),
+ "scalar": annotate("scalar"),
+ "list": annotate("list"),
+ "dict": {"nested_scalar": annotate("scalar"), "nested_list": annotate("list")},
+ "missing": annotate("missing"),
}
- assert [f() for f in parse_dict(parsers, dict)] == [
+ assert [f() for f in parse_dict(parsers, data)] == [
"scalar_foo",
"list_bar",
"list_baz",