Ulrich Eckhardt <ulrich.eckha...@dominolaser.com> writes: > Let's say I have two flags invert X and invert Y. Now, for testing these, I > would write one test for each combination. What I have in the test case is > something like this: > > def test_invert_flags(self): > """test flags to invert coordinates""" > tests = [((10, 20), INVERT_NONE, (10, 20)), > ((10, 20), INVERT_X, (-10, 20)), > ((10, 20), INVERT_Y, (10, -20))] > for input, flags, expected in tests: > res = do_invert(input, flags) > self.assertEqual(res, expected, > "%s caused wrong results" % (flags,))
The ‘testscenarios’ library is designed for just this reason <URL:http://pypi.python.org/pypi/testscenarios/>. It takes a sequence of scenarios, each of which is a tuple just like in your example, and causes a separate test run and report for each one. -- \ “If we listen only to those who are like us, we will squander | `\ the great opportunity before us: To live together peacefully in | _o__) a world of unresolved differences.” —David Weinberger | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list