lundi 6 juillet 2020

How to use Pytest to test functions that generate random samples?

Lets say I generate some input numpy array data using a np.random.normal() in my test_func.py script that is using pytest.

Now I want to call the func.py function that I am testing. How am I able to get testable results? If I set a seed in the test_func.py script, it isn't going to correspond to the random data that gets generated in the func.py function, correct?

I want to be able to create some reference data in test_func.py and then test that the randomness generated in the func.py script is comparable to the reference data I created (hence, testing the randomness and functionality of the func.py function).

Thank you!




Aucun commentaire:

Enregistrer un commentaire