def test_div(self):
     self.cal.a = 5
     self.cal.b = 0
     #pass
     self.assertRaises(ZeroDivisionError,
                       self.cal.div)  ##use callable, dont call
     with self.assertRaises(TypeError):
         self.cal1 = Calculator()
Example #2
0
 def setUpClass(cls):
     print("In setupclass() method")
     cls.cal = Calculator(0, 0)
Example #3
0
 def test_divison(self):
     self.cal.a = 4
     self.cal.b = "0"
     self.assertRaises(ZeroDivisionError, self.cal.div)
     with self.assertRaises(TypeError):
         self.cal1 = Calculator()
 def setUpClass(cls):
     print('called once before any mytests in class')
     cls.cal = Calculator(0, 0)
Example #5
0
 def test_add2_mock(self, mul):
     ins = Calculator(2, 3)
     print(ins.mul())
     self.assertEqual(mul(3, 4), 76)