Using parametrize for multiple arguments in pytest

783 Views Asked by At

There is such a function:

def underscore_concat(*args):
    return "_".join(filter(None, ([*args]))).upper()

How to correctly pass multiple parameters using pytest.mark.parametrize?

Something like this:

@pytest.mark.parametrize("a, result", [(["underscore", "concat", "test"], "UNDERSCORE_CONCAT_TEST")])
def test_underscore_concat(a, result):
    assert underscore_concat(**a) == result
1

There are 1 best solutions below

0
On BEST ANSWER
@pytest.mark.parametrize("a, result", [(["underscore", "concat", "test"], "UNDERSCORE_CONCAT_TEST")])
def test_underscore_concat(a, result):
    assert underscore_concat(*a) == result