When you use paramtrize, the second parameter is a sequence (which can be a list), ond each element and another sequence containing an item for each function parameter.
You want the sequence (1, 0, 0) to be assigned to the variable "input", however the way you did, pytest will take "1" and assign "input" and "0" to assign to "expected" (and probably give an error because there is a third 0 left).
You want to use two sequences at once, in a single test - then
have to create a sequence with them:
@pytest.mark.parametrize('entrada, esperado', [
[(1,0,0,), (1,0,)],
])
def testa_raizes(entrada, esperado):
assert b.calcula_raizes(entrada) == (esperado)
Now yes, pytest takes the first element from the list of entries you pass in the parametrize - this element is [(1,0,0,), (1,0,)],
. He takes the first helmet from there - (1,0,0)
and passes as "input", and (1,0)
as "expected".
In what function are you applying this decorator? You set the arguments as
entrada
andesperado
?– Woss
Yes, I just edited the question, posting the method that receives the input and the expected value to be tested.
– Fernando