def test_basic(polygon_with_multisegment: PolygonWithMultisegment) -> None:
    polygon, multisegment = polygon_with_multisegment

    result = symmetric_subtract_polygon_from_multisegment(multisegment,
                                                          polygon)

    assert is_mix(result) or is_polygon(result)
コード例 #2
0
def test_basic(multipolygons_pair: MultipolygonsPair) -> None:
    left_multipolygon, right_multipolygon = multipolygons_pair

    result = complete_intersect_multipolygons(left_multipolygon,
                                              right_multipolygon)

    assert is_mix(result)
コード例 #3
0
def test_same_coordinates(data: DataObject,
                          coordinates_limits_type: ScalarsLimitsType,
                          components_sizes_pair: Tuple[SizesPair, SizesPair,
                                                       SizesPair],
                          polygons_border_sizes_pair: SizesPair,
                          polygon_holes_sizes_pair: SizesPair,
                          polygon_hole_sizes_pair: SizesPair) -> None:
    ((coordinates, (min_mix_polygon_value, max_mix_polygon_value)),
     type_) = coordinates_limits_type
    points_sizes_pair, segments_sizes_pair, polygons_sizes_pair = (
        components_sizes_pair)
    min_points_size, max_points_size = points_sizes_pair
    min_segments_size, max_segments_size = segments_sizes_pair
    min_polygons_size, max_polygons_size = polygons_sizes_pair
    (min_polygon_border_size,
     max_polygon_border_size) = polygons_border_sizes_pair
    min_polygon_holes_size, max_polygon_holes_size = polygon_holes_sizes_pair
    min_polygon_hole_size, max_polygon_hole_size = polygon_hole_sizes_pair

    strategy = mixes(coordinates,
                     min_points_size=min_points_size,
                     max_points_size=max_points_size,
                     min_segments_size=min_segments_size,
                     max_segments_size=max_segments_size,
                     min_polygons_size=min_polygons_size,
                     max_polygons_size=max_polygons_size,
                     min_polygon_border_size=min_polygon_border_size,
                     max_polygon_border_size=max_polygon_border_size,
                     min_polygon_holes_size=min_polygon_holes_size,
                     max_polygon_holes_size=max_polygon_holes_size,
                     min_polygon_hole_size=min_polygon_hole_size,
                     max_polygon_hole_size=max_polygon_hole_size)

    result = data.draw(strategy)

    assert is_mix(result)
    assert mix_has_valid_sizes(result,
                               min_points_size=min_points_size,
                               max_points_size=max_points_size,
                               min_segments_size=min_segments_size,
                               max_segments_size=max_segments_size,
                               min_polygons_size=min_polygons_size,
                               max_polygons_size=max_polygons_size,
                               min_polygon_border_size=min_polygon_border_size,
                               max_polygon_border_size=max_polygon_border_size,
                               min_polygon_holes_size=min_polygon_holes_size,
                               max_polygon_holes_size=max_polygon_holes_size,
                               min_polygon_hole_size=min_polygon_hole_size,
                               max_polygon_hole_size=max_polygon_hole_size)
    assert mix_has_coordinates_types(result, x_type=type_, y_type=type_)
    assert mix_has_coordinates_in_range(result,
                                        min_x_value=min_mix_polygon_value,
                                        max_x_value=max_mix_polygon_value,
                                        min_y_value=min_mix_polygon_value,
                                        max_y_value=max_mix_polygon_value)
    assert mix_segments_do_not_cross_or_overlap(result)
コード例 #4
0
def test_properties(polygon_with_segment: PolygonWithSegment) -> None:
    polygon, segment = polygon_with_segment

    result = symmetric_subtract_polygon_from_segment(segment, polygon)

    relation = segment_in_polygon(segment, polygon)
    assert (not is_mix(result)
            or (relation in (Relation.DISJOINT, Relation.TOUCH, Relation.CROSS)
                and (is_empty(result.discrete) and not is_empty(result.linear)
                     and are_compounds_similar(result.shaped, polygon))))
    assert (not is_polygon(result) or relation
            in (Relation.COMPONENT, Relation.ENCLOSED, Relation.WITHIN))
コード例 #5
0
def test_properties(
        polygon_with_multisegment: PolygonWithMultisegment) -> None:
    polygon, multisegment = polygon_with_multisegment

    result = unite_multisegment_with_polygon(multisegment, polygon)

    relation = multisegment_in_polygon(multisegment, polygon)
    assert (not is_mix(result)
            or (relation in (Relation.DISJOINT, Relation.TOUCH, Relation.CROSS)
                and (is_empty(result.discrete) and not is_empty(result.linear)
                     and are_compounds_similar(result.shaped, polygon))))
    assert (not is_polygon(result) or relation
            in (Relation.COMPONENT, Relation.ENCLOSED, Relation.WITHIN))
コード例 #6
0
def test_basic(polygon_with_multisegment: PolygonWithMultisegment) -> None:
    polygon, multisegment = polygon_with_multisegment

    result = unite_multisegment_with_polygon(multisegment, polygon)

    assert is_mix(result) or is_polygon(result)