diff options
author | Marc Mueller <30130371+cdce8p@users.noreply.github.com> | 2021-06-01 20:54:10 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-06-10 12:49:20 +0200 |
commit | 5cd19d2f8fab98f707d666f8dabb89c9c8b94f11 (patch) | |
tree | b323ea18a9a5780c1c3ba7158e558c68f680a2e5 /tests | |
parent | b4afe920e3a0fc45025120ca9dd91d7363a0750b (diff) | |
download | pylint-git-5cd19d2f8fab98f707d666f8dabb89c9c8b94f11.tar.gz |
Fix existing code
Diffstat (limited to 'tests')
-rw-r--r-- | tests/checkers/unittest_strings.py | 4 | ||||
-rw-r--r-- | tests/extensions/test_check_raise_docs.py | 6 | ||||
-rw-r--r-- | tests/lint/unittest_lint.py | 8 | ||||
-rw-r--r-- | tests/test_import_graph.py | 2 | ||||
-rw-r--r-- | tests/test_self.py | 2 | ||||
-rw-r--r-- | tests/unittest_pyreverse_diadefs.py | 4 |
6 files changed, 13 insertions, 13 deletions
diff --git a/tests/checkers/unittest_strings.py b/tests/checkers/unittest_strings.py index c8e860dcf..d5d0244b5 100644 --- a/tests/checkers/unittest_strings.py +++ b/tests/checkers/unittest_strings.py @@ -69,14 +69,14 @@ class TestStringChecker(CheckerTestCase): node = astroid.extract_node(code) self.checker.visit_binop(node) - for code, arg_type, format_type in [ + for code, arg_type, format_type in ( ("'%d' % '1'", "builtins.str", "d"), ("'%(key)d' % {'key' : '1'}", "builtins.str", "d"), ("'%x' % 1.1", "builtins.float", "x"), ("'%(key)x' % {'key' : 1.1}", "builtins.float", "x"), ("'%d' % []", "builtins.list", "d"), ("'%(key)d' % {'key' : []}", "builtins.list", "d"), - ]: + ): node = astroid.extract_node(code) with self.assertAddsMessages( Message( diff --git a/tests/extensions/test_check_raise_docs.py b/tests/extensions/test_check_raise_docs.py index 7ed7c405c..80384e192 100644 --- a/tests/extensions/test_check_raise_docs.py +++ b/tests/extensions/test_check_raise_docs.py @@ -202,7 +202,7 @@ class TestDocstringCheckerRaise(CheckerTestCase): import re raise re.error('hi') #@ ''' - for prefix in ["~", "!"]: + for prefix in ("~", "!"): raise_node = astroid.extract_node(code_snippet.format(prefix=prefix)) with self.assertNoMessages(): self.checker.visit_raise(raise_node) @@ -643,7 +643,7 @@ class TestDocstringCheckerRaise(CheckerTestCase): import re raise re.error('hi') #@ ''' - for prefix in ["~", "!"]: + for prefix in ("~", "!"): raise_node = astroid.extract_node(code_snippet.format(prefix=prefix)) with self.assertNoMessages(): self.checker.visit_raise(raise_node) @@ -763,7 +763,7 @@ class TestDocstringCheckerRaise(CheckerTestCase): import re raise re.error('hi') #@ ''' - for prefix in ["~", "!"]: + for prefix in ("~", "!"): raise_node = astroid.extract_node(code_snippet.format(prefix=prefix)) with self.assertNoMessages(): self.checker.visit_raise(raise_node) diff --git a/tests/lint/unittest_lint.py b/tests/lint/unittest_lint.py index 22c93cf24..21748a507 100644 --- a/tests/lint/unittest_lint.py +++ b/tests/lint/unittest_lint.py @@ -220,7 +220,7 @@ def test_more_args(fake_path, case): create_files(["a/b/c/__init__.py", "a/d/__init__.py", "a/e/f.py"]) expected = [ join(chroot, suffix) - for suffix in [sep.join(("a", "b")), "a", sep.join(("a", "e"))] + for suffix in (sep.join(("a", "b")), "a", sep.join(("a", "e"))) ] + fake_path assert sys.path == fake_path @@ -583,7 +583,7 @@ def test_full_documentation(linter): linter.print_full_documentation(out) output = out.getvalue() # A few spot checks only - for re_str in [ + for re_str in ( # autogenerated text "^Pylint global options and switches$", "Verbatim name of the checker is ``python3``", @@ -591,7 +591,7 @@ def test_full_documentation(linter): "^:old-octal-literal \\(E1608\\):", # options "^:dummy-variables-rgx:", - ]: + ): regexp = re.compile(re_str, re.MULTILINE) assert re.search(regexp, output) @@ -756,7 +756,7 @@ def test_custom_should_analyze_file(): package_dir = os.path.join(REGRTEST_DATA_DIR, "bad_package") wrong_file = os.path.join(package_dir, "wrong.py") - for jobs in [1, 2]: + for jobs in (1, 2): reporter = testutils.GenericTestReporter() linter = _CustomPyLinter() linter.config.jobs = jobs diff --git a/tests/test_import_graph.py b/tests/test_import_graph.py index 816e78a0f..9a4071220 100644 --- a/tests/test_import_graph.py +++ b/tests/test_import_graph.py @@ -66,7 +66,7 @@ URL="." node[shape="box"] @pytest.mark.parametrize("filename", ["graph.png", "graph"]) @pytest.mark.skipif( - any(shutil.which(x) for x in ["dot", "gv"]), reason="dot or gv is installed" + any(shutil.which(x) for x in ("dot", "gv")), reason="dot or gv is installed" ) def test_missing_graphviz(filename): """Raises if graphviz is not installed, and defaults to png if no extension given""" diff --git a/tests/test_self.py b/tests/test_self.py index c5653457a..d8da706a7 100644 --- a/tests/test_self.py +++ b/tests/test_self.py @@ -400,7 +400,7 @@ class TestRunTC: assert key in message assert message[key] == value msg = message["message"].lower() - assert any(x in msg for x in ["expected ':'", "invalid syntax"]) + assert any(x in msg for x in ("expected ':'", "invalid syntax")) assert "<unknown>" in msg assert "line 1" in msg diff --git a/tests/unittest_pyreverse_diadefs.py b/tests/unittest_pyreverse_diadefs.py index 8eb333fad..25a8fc363 100644 --- a/tests/unittest_pyreverse_diadefs.py +++ b/tests/unittest_pyreverse_diadefs.py @@ -67,7 +67,7 @@ def test_option_values(HANDLER, PROJECT): assert not df_h.module_names assert cl_h._get_levels() == (-1, -1) assert cl_h.module_names - for hndl in [df_h, cl_h]: + for hndl in (df_h, cl_h): hndl.config.all_ancestors = True hndl.config.all_associated = True hndl.config.module_names = True @@ -79,7 +79,7 @@ def test_option_values(HANDLER, PROJECT): cl_config = Config() cl_config.classes = ["Specialization"] cl_h = DiaDefGenerator(Linker(PROJECT), DiadefsHandler(cl_config)) - for hndl in [df_h, cl_h]: + for hndl in (df_h, cl_h): hndl.config.show_ancestors = 2 hndl.config.show_associated = 1 hndl.config.module_names = False |