-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace values above limit with limit value. (#526)
* Set limit to max value rather than error. Fixes #496. * Update limit tests. * Update changelog.
- Loading branch information
Showing
5 changed files
with
52 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import pytest | ||
from pydantic import ValidationError | ||
|
||
from stac_fastapi.types.search import BaseSearchPostRequest | ||
|
||
|
||
@pytest.mark.parametrize("value", [0, -1]) | ||
def test_limit_ge(value): | ||
with pytest.raises(ValidationError): | ||
BaseSearchPostRequest(limit=value) | ||
|
||
|
||
@pytest.mark.parametrize("value", [1, 10_000]) | ||
def test_limit(value): | ||
search = BaseSearchPostRequest(limit=value) | ||
assert search.limit == value | ||
|
||
|
||
@pytest.mark.parametrize("value", [10_001, 100_000, 1_000_000]) | ||
def test_limit_le(value): | ||
search = BaseSearchPostRequest(limit=value) | ||
assert search.limit == 10_000 |