[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.
This commit is contained in:
Tzu-ping Chung 2024-08-13 16:02:09 +08:00 committed by GitHub
parent 7027344dfc
commit 82a3e69b8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -292,7 +292,7 @@ fn elts_to_csv(elts: &[Expr], generator: Generator) -> Option<String> {
.fold(String::new(), |mut acc, elt| { .fold(String::new(), |mut acc, elt| {
if let Expr::StringLiteral(ast::ExprStringLiteral { value, .. }) = elt { if let Expr::StringLiteral(ast::ExprStringLiteral { value, .. }) = elt {
if !acc.is_empty() { if !acc.is_empty() {
acc.push(','); acc.push_str(", ");
} }
acc.push_str(value.to_str()); acc.push_str(value.to_str());
} }

View file

@ -15,7 +15,7 @@ PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
22 22 | 22 22 |
23 23 | 23 23 |
24 |-@pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)]) 24 |-@pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)])
24 |+@pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) 24 |+@pytest.mark.parametrize("param1, param2", [(1, 2), (3, 4)])
25 25 | def test_tuple(param1, param2): 25 25 | def test_tuple(param1, param2):
26 26 | ... 26 26 | ...
27 27 | 27 27 |
@ -53,7 +53,7 @@ PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
32 32 | 32 32 |
33 33 | 33 33 |
34 |-@pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)]) 34 |-@pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)])
34 |+@pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)]) 34 |+@pytest.mark.parametrize("param1, param2", [(1, 2), (3, 4)])
35 35 | def test_list(param1, param2): 35 35 | def test_list(param1, param2):
36 36 | ... 36 36 | ...
37 37 | 37 37 |