def test_type_3(self): calc = Caculator(isAdd=True, isSub=False, isMul=False, isDiv=False, isRem=False) with self.assertRaises(ValueError): calc.division(0, 1)
def test_error_zero_division(self): calc = Caculator(isAdd=False, isSub=False, isMul=False, isDiv=True, isRem=False) try: calc.division(4, 0) except Exception as e: self.assertRaises(ZeroDivisionError)
def test_division_4(self): calc = Caculator(isAdd=False, isSub=False, isMul=False, isDiv=True, isRem=False) self.assertEqual(calc.division(-4, 2), -2.0)
def test_division_2(self): calc = Caculator(isAdd=False, isSub=False, isMul=False, isDiv=True, isRem=True) self.assertEqual(calc.division(4, -2), (-2.0, 0))
def test_type_4(self): calc = Caculator(isAdd=False, isSub=False, isMul=False, isDiv=True, isRem=False) try: div, rem = calc.division(1, 2) print(div + " and " + rem) except Exception as e: if e != None: pass