-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix single-tuple conversion in pytest-parametrize-values-wrong-type
- Loading branch information
1 parent
de46a36
commit e8d24ff
Showing
8 changed files
with
1,149 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
224 changes: 224 additions & 0 deletions
224
...le/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT007_list_of_lists.snap.new
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,224 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs | ||
assertion_line: 303 | ||
--- | ||
PT007.py:4:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | ||
| | ||
4 | @pytest.mark.parametrize("param", (1, 2)) | ||
| ^^^^^^ PT007 | ||
5 | def test_tuple(param): | ||
6 | ... | ||
| | ||
= help: Use `list` of `list` for parameter values | ||
|
||
ℹ Unsafe fix | ||
1 1 | import pytest | ||
2 2 | | ||
3 3 | | ||
4 |-@pytest.mark.parametrize("param", (1, 2)) | ||
4 |+@pytest.mark.parametrize("param", [1, 2]) | ||
5 5 | def test_tuple(param): | ||
6 6 | ... | ||
7 7 | | ||
|
||
PT007.py:11:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | ||
| | ||
9 | @pytest.mark.parametrize( | ||
10 | ("param1", "param2"), | ||
11 | ( | ||
| _____^ | ||
12 | | (1, 2), | ||
13 | | (3, 4), | ||
14 | | ), | ||
| |_____^ PT007 | ||
15 | ) | ||
16 | def test_tuple_of_tuples(param1, param2): | ||
| | ||
= help: Use `list` of `list` for parameter values | ||
|
||
ℹ Unsafe fix | ||
8 8 | | ||
9 9 | @pytest.mark.parametrize( | ||
10 10 | ("param1", "param2"), | ||
11 |- ( | ||
11 |+ [ | ||
12 12 | (1, 2), | ||
13 13 | (3, 4), | ||
14 |- ), | ||
14 |+ ], | ||
15 15 | ) | ||
16 16 | def test_tuple_of_tuples(param1, param2): | ||
17 17 | ... | ||
|
||
PT007.py:12:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | ||
| | ||
10 | ("param1", "param2"), | ||
11 | ( | ||
12 | (1, 2), | ||
| ^^^^^^ PT007 | ||
13 | (3, 4), | ||
14 | ), | ||
| | ||
= help: Use `list` of `list` for parameter values | ||
|
||
ℹ Unsafe fix | ||
9 9 | @pytest.mark.parametrize( | ||
10 10 | ("param1", "param2"), | ||
11 11 | ( | ||
12 |- (1, 2), | ||
12 |+ [1, 2], | ||
13 13 | (3, 4), | ||
14 14 | ), | ||
15 15 | ) | ||
|
||
PT007.py:13:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | ||
| | ||
11 | ( | ||
12 | (1, 2), | ||
13 | (3, 4), | ||
| ^^^^^^ PT007 | ||
14 | ), | ||
15 | ) | ||
| | ||
= help: Use `list` of `list` for parameter values | ||
|
||
ℹ Unsafe fix | ||
10 10 | ("param1", "param2"), | ||
11 11 | ( | ||
12 12 | (1, 2), | ||
13 |- (3, 4), | ||
13 |+ [3, 4], | ||
14 14 | ), | ||
15 15 | ) | ||
16 16 | def test_tuple_of_tuples(param1, param2): | ||
|
||
PT007.py:22:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | ||
| | ||
20 | @pytest.mark.parametrize( | ||
21 | ("param1", "param2"), | ||
22 | ( | ||
| _____^ | ||
23 | | [1, 2], | ||
24 | | [3, 4], | ||
25 | | ), | ||
| |_____^ PT007 | ||
26 | ) | ||
27 | def test_tuple_of_lists(param1, param2): | ||
| | ||
= help: Use `list` of `list` for parameter values | ||
|
||
ℹ Unsafe fix | ||
19 19 | | ||
20 20 | @pytest.mark.parametrize( | ||
21 21 | ("param1", "param2"), | ||
22 |- ( | ||
22 |+ [ | ||
23 23 | [1, 2], | ||
24 24 | [3, 4], | ||
25 |- ), | ||
25 |+ ], | ||
26 26 | ) | ||
27 27 | def test_tuple_of_lists(param1, param2): | ||
28 28 | ... | ||
|
||
PT007.py:39:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | ||
| | ||
37 | ("param1", "param2"), | ||
38 | [ | ||
39 | (1, 2), | ||
| ^^^^^^ PT007 | ||
40 | (3, 4), | ||
41 | ], | ||
| | ||
= help: Use `list` of `list` for parameter values | ||
|
||
ℹ Unsafe fix | ||
36 36 | @pytest.mark.parametrize( | ||
37 37 | ("param1", "param2"), | ||
38 38 | [ | ||
39 |- (1, 2), | ||
39 |+ [1, 2], | ||
40 40 | (3, 4), | ||
41 41 | ], | ||
42 42 | ) | ||
|
||
PT007.py:40:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | ||
| | ||
38 | [ | ||
39 | (1, 2), | ||
40 | (3, 4), | ||
| ^^^^^^ PT007 | ||
41 | ], | ||
42 | ) | ||
| | ||
= help: Use `list` of `list` for parameter values | ||
|
||
ℹ Unsafe fix | ||
37 37 | ("param1", "param2"), | ||
38 38 | [ | ||
39 39 | (1, 2), | ||
40 |- (3, 4), | ||
40 |+ [3, 4], | ||
41 41 | ], | ||
42 42 | ) | ||
43 43 | def test_list_of_tuples(param1, param2): | ||
|
||
PT007.py:81:38: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | ||
| | ||
80 | @pytest.mark.parametrize("a", [1, 2]) | ||
81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) | ||
| ^^^^^^^^^^^^^^^^ PT007 | ||
82 | @pytest.mark.parametrize("d", [3,]) | ||
83 | @pytest.mark.parametrize( | ||
| | ||
= help: Use `list` of `list` for parameter values | ||
|
||
ℹ Unsafe fix | ||
78 78 | | ||
79 79 | | ||
80 80 | @pytest.mark.parametrize("a", [1, 2]) | ||
81 |-@pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) | ||
81 |+@pytest.mark.parametrize(("b", "c"), [(3, 4), (5, 6)]) | ||
82 82 | @pytest.mark.parametrize("d", [3,]) | ||
83 83 | @pytest.mark.parametrize( | ||
84 84 | "d", | ||
|
||
PT007.py:81:39: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | ||
| | ||
80 | @pytest.mark.parametrize("a", [1, 2]) | ||
81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) | ||
| ^^^^^^ PT007 | ||
82 | @pytest.mark.parametrize("d", [3,]) | ||
83 | @pytest.mark.parametrize( | ||
| | ||
= help: Use `list` of `list` for parameter values | ||
|
||
ℹ Unsafe fix | ||
78 78 | | ||
79 79 | | ||
80 80 | @pytest.mark.parametrize("a", [1, 2]) | ||
81 |-@pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) | ||
81 |+@pytest.mark.parametrize(("b", "c"), ([3, 4], (5, 6))) | ||
82 82 | @pytest.mark.parametrize("d", [3,]) | ||
83 83 | @pytest.mark.parametrize( | ||
84 84 | "d", | ||
|
||
PT007.py:81:47: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list` | ||
| | ||
80 | @pytest.mark.parametrize("a", [1, 2]) | ||
81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) | ||
| ^^^^^^ PT007 | ||
82 | @pytest.mark.parametrize("d", [3,]) | ||
83 | @pytest.mark.parametrize( | ||
| | ||
= help: Use `list` of `list` for parameter values | ||
|
||
ℹ Unsafe fix | ||
78 78 | | ||
79 79 | | ||
80 80 | @pytest.mark.parametrize("a", [1, 2]) | ||
81 |-@pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6))) | ||
81 |+@pytest.mark.parametrize(("b", "c"), ((3, 4), [5, 6])) | ||
82 82 | @pytest.mark.parametrize("d", [3,]) | ||
83 83 | @pytest.mark.parametrize( | ||
84 84 | "d", |
Oops, something went wrong.