pystac-client icon indicating copy to clipboard operation
pystac-client copied to clipboard

Terminate on empty page

Open gadomski opened this issue 3 years ago • 1 comments

Related Issue(s):

  • Closes #334
  • Depends on #337 for pytest-httpserver

Description:

Terminate pagination on an empty page.

PR Checklist:

  • [x] Code is formatted
  • [x] Tests pass
  • [x] Changes are added to the CHANGELOG

gadomski avatar Oct 21 '22 21:10 gadomski

Codecov Report

Base: 85.18% // Head: 85.60% // Increases project coverage by +0.41% :tada:

Coverage data is based on head (6b97e36) compared to base (e45c68d). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #338      +/-   ##
==========================================
+ Coverage   85.18%   85.60%   +0.41%     
==========================================
  Files          11       11              
  Lines         790      792       +2     
==========================================
+ Hits          673      678       +5     
+ Misses        117      114       -3     
Impacted Files Coverage Δ
pystac_client/item_search.py 92.57% <100.00%> (ø)
pystac_client/stac_api_io.py 89.18% <100.00%> (+2.95%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov-commenter avatar Nov 28 '22 18:11 codecov-commenter

Is it possible that the initial page can have no features and we would want to return None?

Yeah, it's a good point, we should return None (to stop iteration) if features is empty on first grab. I'll implement.

gadomski avatar Jan 20 '23 18:01 gadomski

@pjhartzell good catch. I missed the documentation that those pages were used for collection paging as well as item paging. By adding the early short-circuit, I broke of collection fetching tests. I've updated the test suite and the code to handle both item and collection paging.

gadomski avatar Jan 20 '23 18:01 gadomski

good catch. I missed the documentation that those pages were used for collection paging as well as item paging. By adding the early short-circuit, I broke of collection fetching tests.

Well, I wasn't thinking about both collection and item paging either. But glad my suggestion broke stuff enough to make that bubble up. 🙂

pjhartzell avatar Jan 20 '23 19:01 pjhartzell