hello all,
I'm trying parametize my unittest so that I can re-use over and over,
perhaps in a for loop. Consider the following:
'''
import unittest
class TestCalc(unittest.TestCase):
def testAdd(self):
self.assertEqual(7, 7, "Didn't add up")
if __name__=="__main__":
unittest.main()
'''
Simple and straight forward, but I'm trying to get to a place where I can run
it this way:
import unittest
class TestCalc(unittest.TestCase):
def testAdd(self,var):
self.assertEqual(var, 7, "Didn't add up")
if __name__=="__main__":
unittest.main(testAdd(7))
is this possible? I'm finding it hard to use unittest in a for loop. Perhaps
something like:
for val in range(25):
self.assertEqual(val,5,"not equal)
The loop will break after the first failure. Anyone have a good approach for
this? please advise.
cheers,
--
https://mail.python.org/mailman/listinfo/python-list