Saturday, 28 September 2013

How do I run multiple Python test cases in a loop?

How do I run multiple Python test cases in a loop?

I am new to Python and trying to do something I do often in Ruby. Namely,
iterating over a set of indices, using them as argument to function and
comparing its results with an array of fixture outputs.
So I wrote it up like I normally do in Ruby, but this resulted in just one
test case.
def test_output(self):
for i in range(1,11):
....
self.assertEqual(fn(i),output[i])
I'm trying to get the test for every item in the range. How can I do that?

No comments:

Post a Comment