Skip to content

Commit b1c6479

Browse files
committed
format
1 parent b59e927 commit b1c6479

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

tests/routes/test_items.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def test_items_limit_and_offset(app):
6464
assert body["numberReturned"] == 1
6565
assert ["collection", "self", "prev"] == [link["rel"] for link in body["links"]]
6666

67+
# offset overflow, return empty feature collection
6768
response = app.get("/collections/public.landsat_wrs/items?offset=20000")
6869
assert response.status_code == 200
6970
body = response.json()

tifeatures/layer.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -431,13 +431,10 @@ async def query(
431431
async with pool.acquire() as conn:
432432
items = await conn.fetchval(q, *p)
433433

434-
if items and items["features"]:
435-
return (
436-
FeatureCollection(features=items["features"]),
437-
items["total_count"],
438-
)
439-
else:
440-
return FeatureCollection(features=[]), items["total_count"]
434+
return (
435+
FeatureCollection(features=items.get("features") or []),
436+
items["total_count"],
437+
)
441438

442439
async def features(
443440
self,

0 commit comments

Comments
 (0)