def is_point_in_circle(self, point): return distance(self.center.x, self.center.y, point.x, point.y) <= self.radius
def test_distance_from_the_same_point_to_the_same_point_is_zero(): assert distance(1, 2, 1, 2) == 0 assert distance(0, 0, 0, 0) == 0
def test_distance_raises_type_error_with_invalid_input(): with pytest.raises(TypeError): distance('aoeu', 0, 0, 0) with pytest.raises(TypeError): distance(None, 0, 0, 0)
def test_that_order_of_points_does_not_matter(): assert distance(5, 6, 7, 8) == distance(7, 8, 5, 6)
def test_distance_of_points_on_the_same_line_is_equal_to_line_length(): assert distance(0, 0, 0, 7) == 7 assert distance(0, 0, 7, 0) == 7
def test_coordinates_sign_does_not_influence_distance(): assert distance(-1, -2, -3, -4) == distance(1, 2, 3, 4)