Exemple #1
0
def test_basic(tree_with_point_and_n: Tuple[Tree, Point, int]) -> None:
    tree, point, n = tree_with_point_and_n

    result = tree.n_nearest_points(n, point)

    assert isinstance(result, (list, type(tree.points)))
    assert all(is_point(element) for element in result)
def test_basic(tree_with_box: Tuple[Tree, Box]) -> None:
    tree, box = tree_with_box

    result = tree.find_box_points(box)

    assert isinstance(result, list)
    assert all(is_point(element) for element in result)
def test_basic(context_with_multisegment: Tuple[Context, Multisegment]
               ) -> None:
    context, multisegment = context_with_multisegment

    result = context.multisegment_centroid(multisegment)

    assert is_point(result)
def test_basic(
    context_with_segments_pair: Tuple[Context, Tuple[Segment,
                                                     Segment]]) -> None:
    context, (first, second) = context_with_segments_pair

    result = context.segments_intersection(first, second)

    assert is_point(result)
def test_basic(segments: List[Segment]) -> None:
    result = segments_intersections(segments)

    assert isinstance(result, dict)
    assert all(is_point(key) for key in result.keys())
    assert all(isinstance(value, set) for value in result.values())
    assert all(
        isinstance(element, tuple) for value in result.values()
        for element in value)
    assert all(
        len(element) == 2 and all(
            isinstance(coordinate, int) for coordinate in element)
        for value in result.values() for element in value)
Exemple #6
0
def test_basic(segments: List[Segment]) -> None:
    result = segments_intersections(segments)

    assert isinstance(result, dict)
    assert all(
        isinstance(key, tuple) and all(
            isinstance(coordinate, int) for coordinate in key)
        for key in result.keys())
    assert all(
        isinstance(value, tuple) and all(
            is_point(coordinate) for coordinate in value)
        for value in result.values())
    assert all(len(key) == 2 for key in result.keys())
    assert all(1 <= len(value) <= 2 for value in result.values())
def test_same_coordinates(data: DataObject,
                          coordinates_limits_type: ScalarsLimitsType
                          ) -> None:
    (coordinates, (min_value, max_value)), type_ = coordinates_limits_type

    strategy = points(coordinates)

    result = data.draw(strategy)

    assert is_point(result)
    assert point_has_coordinates_types(result,
                                       x_type=type_,
                                       y_type=type_)
    assert point_has_coordinates_in_range(result,
                                          min_x_value=min_value,
                                          max_x_value=max_value,
                                          min_y_value=min_value,
                                          max_y_value=max_value)
def test_properties(data: DataObject,
                    coordinates_limits_type_pair: Tuple[ScalarsLimitsType,
                                                        ScalarsLimitsType]
                    ) -> None:
    (x_coordinates_limits_type,
     y_coordinates_limits_type) = coordinates_limits_type_pair
    ((x_coordinates, (min_x_value, max_x_value)),
     x_type) = x_coordinates_limits_type
    ((y_coordinates, (min_y_value, max_y_value)),
     y_type) = y_coordinates_limits_type

    strategy = points(x_coordinates, y_coordinates)

    result = data.draw(strategy)

    assert is_point(result)
    assert point_has_coordinates_types(result,
                                       x_type=x_type,
                                       y_type=y_type)
    assert point_has_coordinates_in_range(result,
                                          min_x_value=min_x_value,
                                          max_x_value=max_x_value,
                                          min_y_value=min_y_value,
                                          max_y_value=max_y_value)
Exemple #9
0
def test_basic(context_with_contour: Tuple[Context, Contour]) -> None:
    context, contour = context_with_contour

    result = context.contour_centroid(contour)

    assert is_point(result)
def test_basic(tree_with_point: Tuple[Tree, Point]) -> None:
    tree, point = tree_with_point

    result = tree.nearest_point(point)

    assert is_point(result)
Exemple #11
0
def test_basic(context_with_polygons: Tuple[Context, Multipolygon]) -> None:
    context, polygons = context_with_polygons

    result = context.multipolygon_centroid(polygons)

    assert is_point(result)
Exemple #12
0
def test_basic(context_with_polygon: Tuple[Context, Polygon]) -> None:
    context, polygon = context_with_polygon

    result = context.polygon_centroid(polygon)

    assert is_point(result)