Python Unit Testing A Loop Function
This is a followup question from 1 I need to test the function with two given cases in a loop. However, based on the printed results, it seems like only the first iteration is chec
Solution 1:
Remove the return statement
def testMsed(self):
for i in range(self.tot_iter):
print i
fun = rice_output.msed(self.dsed_in[i],self.a_in[i],self.pb_in[i])
value = self.msed_out[i]
testFailureMessage = "Test of function name: %s iteration: %i expected: %i != calculated: %i" % ("msed",i,value,fun)
self.assertEqual(round(fun,3),round(self.msed_out[i],3),testFailureMessage)
Post a Comment for "Python Unit Testing A Loop Function"