Sorry that the question is not descriptive.
My problem is , I have a function that loops over a certain no. of times and picks a random element from a list each time. The problem is while writing testcase for this.
Sample code
def func(given):
combo = [filled by a function]
for i in range(0,given):
com = random.choice(combo)
and my test case is like
@patch('random.choice',2)
def test_func():
func(250)
assert(expected,actual)
so when the test case runs , I want to dynamically give different value in each run for random.choice.
how can this be achieved ?
thanks in advnace
Aucun commentaire:
Enregistrer un commentaire