Пример #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)