Пример #1
0
 def test_TypeError_when_input_is_None(self):
     with pytest.raises(TypeError):
         distance(None)
Пример #2
0
 def test_typical_conditions(self):
     self.assertAlmostEqual(2.82, distance(1, 2, 3, 4), places=1)
Пример #3
0
 def test_order_of_point_does_not_matter(self):
     self.assertEqual(distance(1, 2, 3, 4), distance(3, 4, 1, 2))
Пример #4
0
 def test_only_horizontal_distance(self):
     self.assertEqual(2, distance(1, 1, 3, 1))
Пример #5
0
 def test_only_vertical_distance(self):
     self.assertEqual(2, distance(1, 1, 1, 3))
Пример #6
0
 def test_negative_coordinates(self):
     self.assertEqual(2, distance(-1, -1, -1, -3))
Пример #7
0
 def test_zero_length(self):
     self.assertEqual(0, distance(1, 1, 1, 1))
Пример #8
0
 def test_ValueError_when_input_is_string(self):
     with pytest.raises(ValueError):
         distance("aoeu", 1, 1, 1)