before
import pytest
@pytest.mark.parametrize("foo,bar", [(1, 2), (3, 4)])
class Foo:
def test_foo(self, foo: int, bar: int):
assert foo < bar
@pytest.mark.parametrize("foo,bar", [(1, 2), (3, 4)])
def test_bar(foo: int, bar: int):
assert foo < bar
lint & fix
$ ruff --version
ruff 0.0.247
$ ruff --select PT006 PT006.py
PT006.py:10:26: PT006 [*] Wrong name(s) type in `@pytest.mark.parametrize`, expected `tuple`
Found 1 error.
[*] 1 potentially fixable with the --fix option.
$ ruff --select PT006 --fix PT006.py
Found 1 error (1 fixed, 0 remaining).
after
import pytest
@pytest.mark.parametrize("foo,bar", [(1, 2), (3, 4)])
class Foo:
def test_foo(self, foo: int, bar: int):
assert foo < bar
@pytest.mark.parametrize(("foo", "bar"), [(1, 2), (3, 4)])
def test_bar(foo: int, bar: int):
assert foo < bar
expected
import pytest
@pytest.mark.parametrize(("foo", "bar"), [(1, 2), (3, 4)])
class Foo:
def test_foo(self, foo: int, bar: int):
assert foo < bar
@pytest.mark.parametrize(("foo", "bar"), [(1, 2), (3, 4)])
def test_bar(foo: int, bar: int):
assert foo < bar
before
lint & fix
after
expected