示例#1
0
 def test_plus_function_works_with_integers(self):
     # Arrange
     num1 = num2 = 2
     expected_result = 4
     # Act
     result = summa.plus(num1, num2)
     # Assert
     self.assertEqual(result, expected_result)
示例#2
0
 def test_negative_int_numbers_plus(self):
     result = laskin.plus(-2, -3)
     self.assertEqual(result, -5)
示例#3
0
 def test_int_numbers_plus(self):
     result = laskin.plus(2, 3)
     self.assertEqual(result, 5)
示例#4
0
 def test_error_if_not_numbers_plus(self):
     with self.assertRaises(TypeError):
         laskin.plus(1, "a")
示例#5
0
 def test_if_returns_integer_and_float_plus(self):
     result = laskin.plus(2, 3.2)
     self.assertEqual(result, 5.2)
示例#6
0
 def test_if_returns_floats_plus(self):
     result = laskin.plus(2.4, 3.2)
     self.assertEqual(result, 5.6)
示例#7
0
 def test_summa_neg(self):
     result = plus(-2, -3)
     self.assertEqual(result, -5)
示例#8
0
 def test_summa(self):
     result = plus(2, 3)
     self.assertEqual(result, 5)
示例#9
0
 def test_with_letters(self):
     with self.assertRaises(TypeError):
         plus("a", 0)
示例#10
0
 def test_floats(self):
     result = plus(3.4, 3.5)
     self.assertAlmostEqual(result, 6.9)