Ejemplo n.º 1
0
def test_commutativity(multiregions_pair: MultiregionsPair) -> None:
    left_multiregion, right_multiregion = multiregions_pair

    result = complete_intersect_multiregions(left_multiregion,
                                             right_multiregion)

    assert result == complete_intersect_multiregions(right_multiregion,
                                                     left_multiregion)
Ejemplo n.º 2
0
def test_reversals(multiregions_pair: MultiregionsPair) -> None:
    left_multiregion, right_multiregion = multiregions_pair

    result = complete_intersect_multiregions(left_multiregion,
                                             right_multiregion)

    assert result == complete_intersect_multiregions(
            reverse_multiregion(left_multiregion), right_multiregion)
    assert result == complete_intersect_multiregions(
            left_multiregion, reverse_multiregion(right_multiregion))
    assert result == complete_intersect_multiregions(
            reverse_multiregion_regions(left_multiregion), right_multiregion)
    assert result == complete_intersect_multiregions(
            left_multiregion, reverse_multiregion_regions(right_multiregion))
Ejemplo n.º 3
0
def test_right_absorbing_element(empty_multiregion_with_multiregion
                                 : MultiregionsPair) -> None:
    empty_multiregion, multiregion = empty_multiregion_with_multiregion

    result = complete_intersect_multiregions(multiregion, empty_multiregion)

    assert is_holeless_mix_empty(result)
Ejemplo n.º 4
0
def test_basic(multiregions_pair: MultiregionsPair) -> None:
    left_multiregion, right_multiregion = multiregions_pair

    result = complete_intersect_multiregions(left_multiregion,
                                             right_multiregion)

    assert is_holeless_mix(result)
Ejemplo n.º 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))
Ejemplo n.º 6
0
def test_connection_with_intersect(multiregions_pair: MultiregionsPair
                                   ) -> None:
    left_multiregion, right_multiregion = multiregions_pair

    result = complete_intersect_multiregions(left_multiregion,
                                             right_multiregion)

    _, _, multiregion = result
    assert multiregion == intersect_multiregions(left_multiregion,
                                                 right_multiregion)
Ejemplo n.º 7
0
def test_idempotence(multiregion: Multiregion) -> None:
    result = complete_intersect_multiregions(multiregion, multiregion)

    assert holeless_mix_similar_to_multiregion(result, multiregion)