From 36ede4eb05c508b727e41a0f43cc3c88c7a94633 Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Fri, 15 Nov 2024 15:52:00 +0100 Subject: backend/lint: Do not shadow certain builtins This commit enables ruff's flake8-builtin linter that emits warnings when builtin functions are shadowed. This is useful for builtins like "dict", "list", or "str" which we use often. Given the nature of this program we historically rely a lot on the usage of "id", "hash", and "filter" as variable names which also shadow Python builtins. For now let's ignore those, we have not used any of them in our code and the impact to the codebase would be considerable. This might be revisited in the future. --- tests/api/test_comic.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/api/test_comic.py') 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 -- cgit v1.2.3-2-gb3c3