I'm creating tests for a class using doctest. One of its functions has a random component so its output can vary. I have tried using random.seed()
but it changes when I run the file again.
I have tried (too) to use doctest ellipsis but the number can change as the following example:
>>> my_function(params)
9.99
>>> my_function(params)
10.01
Is there a function to test "around" a number, for example using 10 in test and accepting 9.99 and 10.01 as well?
Aucun commentaire:
Enregistrer un commentaire