Skip to content

Commit

Permalink
actually clean up matched logic
Browse files Browse the repository at this point in the history
  • Loading branch information
hrodmn committed Oct 10, 2024
1 parent fce4bd0 commit 63b58cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
8 changes: 3 additions & 5 deletions pystac_client/collection_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,12 @@ def matched(self) -> Optional[int]:

if not found:
count = len(page["collections"])

for page in iter:
print(f"found {len(page['collections'])} on the next page")
count += len(page["collections"])

# if context is missing or if collection search and free-text are not supported,
# just count the records
if found is None:
warnings.warn("numberMatched or context.matched not in response")
found = len(self.collection_list())
found = count

return found

Expand Down
5 changes: 1 addition & 4 deletions tests/test_collection_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,7 @@ def test_matched(self) -> None:
limit=4,
)

with pytest.warns(
UserWarning, match="numberMatched or context.matched not in response"
):
assert search.matched() == 5
assert search.matched() == 5

@pytest.mark.vcr
def test_enabled_but_client_side_q(self) -> None:
Expand Down

0 comments on commit 63b58cc

Please sign in to comment.