Skip to content

Commit 097a627

Browse files
authored
chore: add test (#131)
Closes #80 as cant-reproduce.
1 parent 07f89b7 commit 097a627

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/test_search.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,27 @@ async def test_proj_geometry(maxar_items: list[dict[str, Any]], tmp_path: Path)
6868

6969

7070
async def test_search_to_store(data: Path) -> None:
71+
# https://github.com/stac-utils/rustac-py/issues/129
7172
store = MemoryStore()
7273
count = await rustac.search_to(
7374
"items.json", str(data / "100-sentinel-2-items.parquet"), store=store
7475
)
7576
assert count == 100
7677
item_collection = await rustac.read("items.json", store=store)
7778
assert len(item_collection["features"]) == 100
79+
80+
81+
async def test_list_sortby(data: Path) -> None:
82+
# https://github.com/stac-utils/rustac-py/issues/80
83+
items = await rustac.search(
84+
str(data / "100-sentinel-2-items.parquet"),
85+
sortby=[
86+
{"field": "datetime", "direction": "desc"},
87+
{"field": "id", "direction": "asc"},
88+
],
89+
)
90+
for first, second in zip(items, items[1:]):
91+
if first["properties"]["datetime"] == second["properties"]["datetime"]:
92+
assert first["id"] <= second["id"]
93+
else:
94+
assert first["properties"]["datetime"] >= second["properties"]["datetime"]

0 commit comments

Comments
 (0)