-
Notifications
You must be signed in to change notification settings - Fork 7
99 datetimeinterval RFC 3339 #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
phil-osk
wants to merge
12
commits into
stapi-spec:main
Choose a base branch
from
phil-osk:99-datetimeinterval-pydantic-model
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
bf76aad
add cli with 5 commands: product, products, order, orders, opportunities
phil-osk bfdd154
Merge branch 'main' into main
phil-osk 11b9fc6
Merge branch 'main' into main
phil-osk d44efe0
simpler json output, send errors to err
phil-osk a2dbc44
reformat for linter
phil-osk 02255ad
Merge branch 'main' of github.com:phil-osk/pystapi
phil-osk 8481b6c
remove types-click from parent pyproject.toml
phil-osk d46641e
Merge branch 'stapi-spec:main' into remove-types-click
phil-osk 3b2d167
make DatetimeInterval RFC 3339 compliant
phil-osk 9c212cb
Merge branch 'stapi-spec:main' into 99-datetimeinterval-pydantic-model
phil-osk a97129d
add a couple more tests to datetime interval; synch pytest versions
phil-osk 7d245a2
reformat
phil-osk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,21 @@ | ||
import pytest | ||
from stapi_pydantic import DatetimeInterval | ||
|
||
|
||
def test_valid_datetime_intervals() -> None: | ||
"""Test the datetime interval validator.""" | ||
dt1 = DatetimeInterval.__metadata__[0].func("2025-04-01T00:00:00Z/2025-04-01T23:59:59Z") | ||
_ = DatetimeInterval.__metadata__[1].func(dt1) | ||
dt2 = DatetimeInterval.__metadata__[0].func("2025-04-01T00:00:00Z/..") | ||
_ = DatetimeInterval.__metadata__[1].func(dt2) | ||
dt3 = DatetimeInterval.__metadata__[0].func("../2025-04-01T23:59:59Z") | ||
_ = DatetimeInterval.__metadata__[1].func(dt3) | ||
dt4 = DatetimeInterval.__metadata__[0].func("../..") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue: this should fail, per prior comment |
||
_ = DatetimeInterval.__metadata__[1].func(dt4) | ||
|
||
|
||
def test_invalid_datetime_intervals() -> None: | ||
"""Test the datetime interval validator.""" | ||
with pytest.raises(ValueError, match="end before start"): | ||
dt1 = DatetimeInterval.__metadata__[0].func("2025-04-01T00:00:00Z/2025-03-01T23:59:59Z") | ||
_ = DatetimeInterval.__metadata__[1].func(dt1) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: one of the intervals has to closed, e.g.,
../..
and/
are not allowed. The code from stac-server (that I believe to be correct) is: