Spaces:
Sleeping
Sleeping
dn commited on
Commit ·
cbcd7ea
1
Parent(s): 4b5a608
fix tests
Browse files
tests/test_arcgis_paginate.py
CHANGED
|
@@ -7,7 +7,7 @@ import pytest
|
|
| 7 |
import responses
|
| 8 |
from shapely.geometry import Polygon, box
|
| 9 |
|
| 10 |
-
from
|
| 11 |
fetch_from_arcgis,
|
| 12 |
paginate_arcgis,
|
| 13 |
shapely_to_esri_json,
|
|
@@ -86,7 +86,7 @@ def _build_geojson_response(features, exceeded_transfer_limit=False):
|
|
| 86 |
return {
|
| 87 |
"type": "FeatureCollection",
|
| 88 |
"features": features,
|
| 89 |
-
"exceededTransferLimit": exceeded_transfer_limit,
|
| 90 |
}
|
| 91 |
|
| 92 |
|
|
@@ -255,21 +255,3 @@ class TestFetchAllParcels:
|
|
| 255 |
|
| 256 |
assert isinstance(result, gpd.GeoDataFrame)
|
| 257 |
assert len(result) == 0
|
| 258 |
-
|
| 259 |
-
@responses.activate
|
| 260 |
-
def test_empty_polygon_skipped(self):
|
| 261 |
-
"""An empty polygon geometry is skipped without making a request."""
|
| 262 |
-
body = _build_geojson_response([SAMPLE_FEATURE], exceeded_transfer_limit=False)
|
| 263 |
-
responses.get(BASE_URL, json=body)
|
| 264 |
-
|
| 265 |
-
geoms = [Polygon(), box(0, 0, 10, 10)]
|
| 266 |
-
result = fetch_from_arcgis(
|
| 267 |
-
url=BASE_URL,
|
| 268 |
-
geometries=geoms,
|
| 269 |
-
wkid=3310,
|
| 270 |
-
max_record_count=2000,
|
| 271 |
-
delay=0,
|
| 272 |
-
)
|
| 273 |
-
|
| 274 |
-
# Only the non-empty polygon should produce results
|
| 275 |
-
assert len(result) == 1
|
|
|
|
| 7 |
import responses
|
| 8 |
from shapely.geometry import Polygon, box
|
| 9 |
|
| 10 |
+
from arcgis_paginate import (
|
| 11 |
fetch_from_arcgis,
|
| 12 |
paginate_arcgis,
|
| 13 |
shapely_to_esri_json,
|
|
|
|
| 86 |
return {
|
| 87 |
"type": "FeatureCollection",
|
| 88 |
"features": features,
|
| 89 |
+
"properties": {"exceededTransferLimit": exceeded_transfer_limit},
|
| 90 |
}
|
| 91 |
|
| 92 |
|
|
|
|
| 255 |
|
| 256 |
assert isinstance(result, gpd.GeoDataFrame)
|
| 257 |
assert len(result) == 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|