mardi 17 mars 2020

How to parameterize a non-deterministic function in pytest?

Say I have a function which returns a random item from a list:

def get_item(L):
    if not L: return None
    return random.choice(L)

How can I use parameterization with pytest to test both cases?

Aucun commentaire:

Enregistrer un commentaire