예제 #1
0
 def test_divide_non_int_type(self):
     with self.assertRaises(TypeError):
         Calculator.quotient(30, "r")
예제 #2
0
 def test_zero_division(self):
     with self.assertRaises(ZeroDivisionError):
         Calculator.quotient(30, 0)
예제 #3
0
 def test_divide_result_type(self):
     self.assertIsInstance(Calculator.quotient(30, 5), float)
     self.assertIsInstance(Calculator.quotient(15, 5), float)
     self.assertIsInstance(Calculator.quotient(34, 10), float)
예제 #4
0
 def test_add_result(self):
     self.assertEqual(Calculator.add(2, 3), 5)
     self.assertEqual(Calculator.add(-2, -3), -5)
     self.assertEqual(Calculator.add(-2, 3), 1)
     self.assertEqual(Calculator.add(277777777, 50000000), 277777777 + 50000000)
예제 #5
0
 def test_subtract_non_int_type(self):
     with self.assertRaises(TypeError):
         Calculator.difference(56, "u")
예제 #6
0
 def test_divide_result(self):
     self.assertEqual(Calculator.quotient(30, 5), 6)
     self.assertEqual(Calculator.quotient(15, 5), 3)
     self.assertEqual(Calculator.quotient(20, 2), 10)
예제 #7
0
 def test_subtract_result(self):
     self.assertEqual(Calculator.difference(56, 6), 50)
     self.assertEqual(Calculator.difference(3, -9), 12)
     self.assertEqual(Calculator.difference(34, 10), 24)
예제 #8
0
 def test_subtract_result_type(self):
     self.assertIsInstance(Calculator.difference(56, 6), int)
     self.assertIsInstance(Calculator.difference(3, -9), int)
     self.assertIsInstance(Calculator.difference(34, 10), int)
예제 #9
0
 def test_multiply_non_int_type(self):
     with self.assertRaises(TypeError):
         Calculator.product(3, "j")
예제 #10
0
 def test_multiply_result_type(self):
     self.assertIsInstance(Calculator.product(3, 3), int)
     self.assertIsInstance(Calculator.product(5, 2), int)
     self.assertIsInstance(Calculator.product(100, 5), int)
예제 #11
0
 def test_multiply_result(self):
     self.assertEquals(Calculator.product(3, 3), 9)
     self.assertEquals(Calculator.product(5, 2), 10)
     self.assertEquals(Calculator.product(100, 5), 500)
예제 #12
0
 def test_add_non_int_type(self):
     with self.assertRaises(TypeError):
         Calculator.add(2, "d")
예제 #13
0
 def test_add_result_type(self):
     self.assertIsInstance(Calculator.add(2, 3), int)
     self.assertIsInstance(Calculator.add(-2, -3), int)
     self.assertIsInstance(Calculator.add(-2, 3), int)
     self.assertIsInstance(Calculator.add(277777777, 50000000), int)