Skip to content

Commit

Permalink
chore: add andorra parsing extract example
Browse files Browse the repository at this point in the history
  • Loading branch information
RaczeQ committed Jan 30, 2024
1 parent a3039be commit 6d85bf1
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tests/base/test_pbf_file_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import pytest
import six
from parametrization import Parametrization as P
from shapely import hausdorff_distance
from shapely import from_wkt, hausdorff_distance
from shapely.geometry import MultiPolygon, Polygon
from shapely.geometry.base import BaseGeometry
from shapely.ops import unary_union
Expand Down Expand Up @@ -108,7 +108,7 @@ def test_pbf_reader_geometry_filtering(): # type: ignore
assert len(features_gdf) == 0


def test_unique_osm_ids(): # type: ignore
def test_unique_osm_ids_duplicated_file(): # type: ignore
"""Test if function returns results without duplicated features."""
monaco_file_path = Path(__file__).parent.parent / "test_files" / "monaco.osm.pbf"
result_gdf = PbfFileReader().get_features_gdf(
Expand All @@ -123,6 +123,20 @@ def test_unique_osm_ids(): # type: ignore
assert len(result_gdf.index) == len(single_result_gdf.index)


def test_unique_osm_ids_real_example(): # type: ignore
"""Test if function returns results without duplicated features."""
andorra_geometry = from_wkt(
"POLYGON ((1.382599544073372 42.67676873293743, 1.382599544073372 42.40065303248514,"
" 1.8092269635579328 42.40065303248514, 1.8092269635579328 42.67676873293743,"
" 1.382599544073372 42.67676873293743))"
)
result_gdf = PbfFileReader(geometry_filter=andorra_geometry).get_features_gdf_from_geometry(
ignore_cache=True
)

assert result_gdf.index.is_unique


@pytest.mark.parametrize( # type: ignore
"filter_osm_ids,expected_result_length",
[
Expand Down

0 comments on commit 6d85bf1

Please sign in to comment.