From 4a515df3a0e051510c2fd8966ab6df136f01794b Mon Sep 17 00:00:00 2001 From: Satoru Sato Date: Wed, 13 Aug 2025 17:21:26 +0900 Subject: [PATCH 1/2] fix: corrections for flake8: C4808; rewrite dict() with {} (literal) --- tests/dicts/test_functions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/dicts/test_functions.py b/tests/dicts/test_functions.py index f4330237..5d00c5df 100644 --- a/tests/dicts/test_functions.py +++ b/tests/dicts/test_functions.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2021 - 2024 Satoru SATOH +# Copyright (C) 2021 - 2025 Satoru SATOH # SPDX-License-Identifier: MIT # # pylint: disable=missing-docstring,protected-access @@ -44,8 +44,8 @@ def test_split_path(args, exp): # FIXME: Add some more test cases @pytest.mark.parametrize( ("args", "exp"), - (((dict(a=1, b=dict(c=2, )), "a.b.d", 3), - dict(a=dict(b=dict(d=3)), b=dict(c=2))), + ((({"a": 1, "b": {"c": 2}}, "a.b.d", 3), + {"a": {"b": {"d": 3}}, "b": {"c": 2}}), ), ) def test_set_(args, exp): @@ -61,10 +61,10 @@ def test_set_(args, exp): ("obj", "opts", "exp"), ((OD((("a", 1), )), {"ac_ordered": False, "ac_dict": dict}, - dict(a=1)), + {"a": 1}), (OD((("a", OD((("b", OD((("c", 1), ))), ))), )), {"ac_ordered": False, "ac_dict": dict}, - dict(a=dict(b=dict(c=1)))), + {"a": {"b": {"c": 1}}}), ), ) def test_convert_to(obj, opts, exp): From dd7774de23d8a5d7762ec8a0acb0841d13329ae4 Mon Sep 17 00:00:00 2001 From: Satoru Sato Date: Wed, 13 Aug 2025 18:05:01 +0900 Subject: [PATCH 2/2] fix: corrections for flake8-comprehensions: C40* {list,set,dict} comprehensions --- tests/dicts/test_functions.py | 2 +- tests/processors/test_processors.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/dicts/test_functions.py b/tests/dicts/test_functions.py index 5d00c5df..d6ed5ae7 100644 --- a/tests/dicts/test_functions.py +++ b/tests/dicts/test_functions.py @@ -73,7 +73,7 @@ def test_convert_to(obj, opts, exp): @pytest.mark.parametrize( ("objs", "exp"), - ((([], (), [x for x in range(10)], (x for x in range(4))), True), + ((([], (), list(range(10)), list(range(4))), True), (([], {}), False), (([], "aaa"), False), ), diff --git a/tests/processors/test_processors.py b/tests/processors/test_processors.py index b29df125..bb3226fd 100644 --- a/tests/processors/test_processors.py +++ b/tests/processors/test_processors.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2018 - 2024 Satoru SATOH +# Copyright (C) 2018 - 2025 Satoru SATOH # SPDX-License-Identifier: MIT # # pylint: disable=missing-docstring @@ -46,8 +46,8 @@ def test_processor_list_x(): with pytest.raises(ValueError): prcs.list_x() - assert prcs.list_x("cid") == sorted(set(p.cid() for p in PRS)) - assert prcs.list_x("type") == sorted(set(p.type() for p in PRS)) + assert prcs.list_x("cid") == sorted({p.cid() for p in PRS}) + assert prcs.list_x("type") == sorted({p.type() for p in PRS}) res = sorted(set(A.extensions() + B.extensions() + C.extensions())) assert prcs.list_x("extension") == res