lundi 15 mai 2023

How to check the same function with random returns different values each time using Pytest?

I have a function that should return a random different value every run.

Let's say

def foo_random():
    return np.random.randint(0, 1000)

I want to test that out of 10 runs, this function returned at least 2 different values using Pytest.

Is something similar supported?




Aucun commentaire:

Enregistrer un commentaire