示例#1
0
def test_commutativity(multipolygons_pair: MultipolygonsPair) -> None:
    left_multipolygon, right_multipolygon = multipolygons_pair

    result = complete_intersect_multipolygons(left_multipolygon,
                                              right_multipolygon)

    assert result == complete_intersect_multipolygons(right_multipolygon,
                                                      left_multipolygon)
示例#2
0
def test_right_absorbing_element(
        empty_multipolygon_with_multipolygon: MultipolygonsPair) -> None:
    empty_multipolygon, multipolygon = empty_multipolygon_with_multipolygon

    result = complete_intersect_multipolygons(multipolygon, empty_multipolygon)

    assert is_mix_empty(result)
示例#3
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)
示例#4
0
def test_absorption_identity(multipolygons_pair: MultipolygonsPair) -> None:
    left_multipolygon, right_multipolygon = multipolygons_pair

    result = complete_intersect_multipolygons(
        left_multipolygon,
        unite_multipolygons(left_multipolygon, right_multipolygon))

    assert mix_similar_to_multipolygon(result, left_multipolygon)
示例#5
0
 def _intersect_with_multipolygon(
         self, other: 'Multipolygon[Coordinate]') -> Compound[Coordinate]:
     return (complete_intersect_multipolygons(
         self, other, context=self._context) if
             (_multipolygon_has_holes(self)
              or _multipolygon_has_holes(other)) else
             complete_intersect_multiregions(self._as_multiregion(),
                                             other._as_multiregion(),
                                             context=self._context))
示例#6
0
def test_connection_with_intersect(
        multipolygons_pair: MultipolygonsPair) -> None:
    left_multipolygon, right_multipolygon = multipolygons_pair

    result = complete_intersect_multipolygons(left_multipolygon,
                                              right_multipolygon)

    _, _, multipolygon = result
    assert multipolygon == intersect_multipolygons(left_multipolygon,
                                                   right_multipolygon)
示例#7
0
def test_reversals(multipolygons_pair: MultipolygonsPair) -> None:
    left_multipolygon, right_multipolygon = multipolygons_pair

    result = complete_intersect_multipolygons(left_multipolygon,
                                              right_multipolygon)

    assert result == complete_intersect_multipolygons(
        reverse_multipolygon(left_multipolygon), right_multipolygon)
    assert result == complete_intersect_multipolygons(
        left_multipolygon, reverse_multipolygon(right_multipolygon))
    assert result == complete_intersect_multipolygons(
        reverse_multipolygon_borders(left_multipolygon), right_multipolygon)
    assert result == complete_intersect_multipolygons(
        left_multipolygon, reverse_multipolygon_borders(right_multipolygon))
    assert result == complete_intersect_multipolygons(
        reverse_multipolygon_holes(left_multipolygon), right_multipolygon)
    assert result == complete_intersect_multipolygons(
        left_multipolygon, reverse_multipolygon_holes(right_multipolygon))
    assert result == complete_intersect_multipolygons(
        reverse_multipolygon_holes_contours(left_multipolygon),
        right_multipolygon)
    assert result == complete_intersect_multipolygons(
        left_multipolygon,
        reverse_multipolygon_holes_contours(right_multipolygon))
示例#8
0
def test_idempotence(multipolygon: Multipolygon) -> None:
    result = complete_intersect_multipolygons(multipolygon, multipolygon)

    assert mix_similar_to_multipolygon(result, multipolygon)