def test_only_vertical_distance(self): self.assertEqual(distance(0, 5, 0, 1), 4)
def test_on_none(self): with self.assertRaises(TypeError): distance(None, 1, 2, 3)
def test_different_points_1(self): assert math.isclose(distance(1, 1, 2, 2), math.sqrt(2))
def test_order_of_points(self): assert distance(1, 1, 4, 5) == distance(4, 5, 1, 1)
def test_string_as_fourth_parameter(self): with pytest.raises(TypeError): distance(1, 1, 2, 'aoeu')
def test_only_vertical_distance(self): assert distance(5, 3, 5, 1) == 2
def test_non_integer(self): with self.assertRaises(TypeError): distance('aoeu', 1, 2, 3)
def test_string_as_first_parameter(self): with pytest.raises(TypeError): distance('aoeu', 1, 2, 2)
def test_type_test(self): with pytest.raises(TypeError): lengt_seg.distance(None, 0, 1, 1)
def test_distance(self): list_arg = [-5, -10, -5, -20] assert lengt_seg.distance(list_arg) == 10.0
def test_the_order_of_point_does_not_matter(self): self.assertEqual(distance(9, 5, 5, 2), distance(5, 2, 9, 5))
def test_typical_conditions(self): self.assertEqual(distance(9, 5, 5, 2), 5)
def test_only_horizontal_distance(self): self.assertEqual(distance(5, 0, 1, 0), 4)
def test_none_as_third_parameter(self): with pytest.raises(TypeError): distance(1, 1, None, 2)
def test_zero_length(self): self.assertEqual(distance(2, 2, 2, 2), 0)
def test_none_as_fourth_parameter(self): with pytest.raises(TypeError): distance(1, 1, 2, None)
def test_negative_coordinates(self): self.assertEqual(distance(-2, -7, -13, -1), 12.529964086141668)
def test_string_as_third_parameter(self): with pytest.raises(TypeError): distance(1, 1, 'aoeu', 2)
def test_vertical_distance(self): self.assertEqual(distance(2, 2, 2, 12), 10)
def test_zero_length(self): assert distance(1, 1, 1, 1) == 0
def test_horizontal_distance(self): self.assertEqual(distance(2, 2, 12, 2), 10)
def test_only_horizontal_distance(self): assert distance(3, 2, 7, 2) == 4
def test_typical_coordinates(self): self.assertEqual(distance(2, 3, 12, 4), 10.04987562112089)
def test_different_points_2(self): assert math.isclose(distance(0, 5, 1, 3), math.sqrt(5))
def test_points_order(self): distance1 = distance(1, 2, 3, 4) distance2 = distance(3, 4, 1, 2) self.assertEqual(distance1, distance2)
def test_none_as_first_parameter(self): with pytest.raises(TypeError): distance(None, 1, 2, 2)
def test_negative_coordinates(self): self.assertEqual(distance(-3, 5, -1, 5), 2)