Hello,guys! I am trying to run the following test
self.assertRaises(Exception,lambda:
unit_test.testBasic())
where
test.testBasic()
is
class IsPrimeTest(unittest.TestCase):
def assertRaises(self,exception,callable,*args,**kwargs):
print('dfdf')
temp = callable
super().assertRaises(exception,temp,*args,**kwargs)
def testBasic_helper(self):
self.failIf(is_prime(2))
self.assertTrue(is_prime(1))
where prime is a function,and
but in
self.assertRaises(Exception,lambda:
unit_test.testBasic())
the lambda function doesnt throws an exception after
the test
def testBasic_helper(self):
self.failIf(is_prime(2))
self.assertTrue(is_prime(1))
fails
Can somebody offers a solution to the problem?