Exemplo n.º 1
0
 def test_that_add_result_type_is_int(self):
     self.assertEqual(int, type(Calculator.add(2, 3)))
     self.assertIsInstance(Calculator.add(2, 3), int)
Exemplo n.º 2
0
 def test_that_non_int_cannot_be_divided_by_int(self):
     with self.assertRaises(TypeError):
         Calculator.divide("1", 1)
Exemplo n.º 3
0
 def test_that_illegal_number_of_arguments_cant_be_passed_into_the_division_method(
         self):
     with self.assertRaises(TypeError):
         self.assertEqual(Calculator.divide(4, 2, 1), 2)
Exemplo n.º 4
0
 def test_that_illegal_number_of_arguments_cant_be_passed_into_the_multiplied_method(
         self):
     with self.assertRaises(TypeError):
         self.assertEqual(Calculator.multiply(2, 3, 4), 6)
Exemplo n.º 5
0
 def test_that_method_can_divide_two_numbers(self):
     self.assertEqual(0, Calculator.divide(2, 3))
Exemplo n.º 6
0
 def test_that_non_int_cannot_be_multiplied_by_int(self):
     with self.assertRaises(TypeError):
         Calculator.multiply("1", 1)
Exemplo n.º 7
0
 def test_that_method_can_add_two_numbers(self):
     self.assertEqual(5, Calculator.add(2, 3))
Exemplo n.º 8
0
 def test_that_illegal_number_of_arguments_cant_be_passed_into_the_subtract_method(
         self):
     with self.assertRaises(TypeError):
         self.assertEqual(Calculator.subtract(2, 3, 4), -1)
Exemplo n.º 9
0
 def test_that_method_can_multiply_two_numbers(self):
     self.assertEqual(6, Calculator.multiply(2, 3))
Exemplo n.º 10
0
 def test_that_non_int_cannot_be_subtracted_by_int(self):
     with self.assertRaises(TypeError):
         Calculator.subtract("1", 1)
Exemplo n.º 11
0
 def test_that_subtract_result_type_is_int(self):
     self.assertEqual(int, type(Calculator.subtract(2, 3)))
     self.assertIsInstance(Calculator.subtract(2, 3), int)
Exemplo n.º 12
0
 def test_that_method_can_subtract_two_numbers(self):
     self.assertEqual(-1, Calculator.subtract(2, 3))
Exemplo n.º 13
0
 def test_that_illegal_number_of_arguments_cant_be_passed_into_the_add_method(
         self):
     with self.assertRaises(TypeError):
         self.assertEquals(Calculator.add(2, 3, -9), -6)
Exemplo n.º 14
0
 def test_that_non_int_cannot_be_added_to_int(self):
     with self.assertRaises(TypeError):
         Calculator.add("1", 1)