Skip to content

Commit 82a3e69

Browse files
authored
[flake8-pytest-style] Add a space after comma in CSV output (PT006) (#12853)
## Summary See #12703. This only addresses the first bullet point, adding a space after the comma in the suggested fix from list/tuple to string. ## Test Plan Updated the snapshots and compared.
1 parent 7027344 commit 82a3e69

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

crates/ruff_linter/src/rules/flake8_pytest_style/rules/parametrize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ fn elts_to_csv(elts: &[Expr], generator: Generator) -> Option<String> {
292292
.fold(String::new(), |mut acc, elt| {
293293
if let Expr::StringLiteral(ast::ExprStringLiteral { value, .. }) = elt {
294294
if !acc.is_empty() {
295-
acc.push(',');
295+
acc.push_str(", ");
296296
}
297297
acc.push_str(value.to_str());
298298
}

crates/ruff_linter/src/rules/flake8_pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT006_csv.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
1515
22 22 |
1616
23 23 |
1717
24 |-@pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)])
18-
24 |+@pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)])
18+
24 |+@pytest.mark.parametrize("param1, param2", [(1, 2), (3, 4)])
1919
25 25 | def test_tuple(param1, param2):
2020
26 26 | ...
2121
27 27 |
@@ -53,7 +53,7 @@ PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
5353
32 32 |
5454
33 33 |
5555
34 |-@pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)])
56-
34 |+@pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)])
56+
34 |+@pytest.mark.parametrize("param1, param2", [(1, 2), (3, 4)])
5757
35 35 | def test_list(param1, param2):
5858
36 36 | ...
5959
37 37 |

0 commit comments

Comments
 (0)