Skip to content

repeated-static-call-cases

Three same-shape literal call assertions may be independent parameter cases.

Why

When the calls are independent, named parameters isolate failures and identify the input that failed. Literal syntax alone cannot prove independence.

Fix

Consider a named pytest parameter table only when call order, shared state, fixture lifecycle, and object identity are not part of the contract; otherwise keep the assertions together or suppress the warning.

Examples

Before — flagged Do not hide independent inputs in one callback
tests/test_parser.py
def test_parse():
assert parse("a") == 1
assert parse("b") == 2
assert parse("c") == 3
After — preferred Give each parser input a runner-visible case
tests/test_parser.py
@pytest.mark.parametrize(("value", "expected"), [("a", 1), ("b", 2), ("c", 3)])
def test_parse(value, expected):
assert parse(value) == expected

Formerly: repeated-static-call-assertions