Sort extension tests failing
jamesfisher-geo opened this issue · 2 comments
jamesfisher-geo commented
Some tests of the sort extension are failing when I run make test
on a clean pull from main
. It looks like this is just due to a type error in the tests introduced in the update to 3.0.0a.
The first_item property needs to be converted to a datetime
another_item_date = first_item["properties"]["datetime"] - timedelta(days=1)
I get
FAILED api/test_api.py::test_app_sort_extension_get_asc - TypeError: unsupported operand type(s) for -: 'str' and 'datetime.timedelta'
FAILED api/test_api.py::test_app_sort_extension_get_desc - TypeError: unsupported operand type(s) for -: 'str' and 'datetime.timedelta'
FAILED api/test_api.py::test_app_sort_extension_post_asc - TypeError: unsupported operand type(s) for -: 'str' and 'datetime.timedelta'
FAILED api/test_api.py::test_app_sort_extension_post_desc - TypeError: unsupported operand type(s) for -: 'str' and 'datetime.timedelta'
To Reproduce
git clone
make test
jonhealy1 commented
Hi. I should have pinned stac-fastapi to 3.0.0a0 instead of 3.0.0a. When stac-fastapi 3.0.0a1 was released it introduced this
jamesfisher-geo commented
Got it. So this is caused by stac-fastapi now requiring datetimes to be timezone aware?
I have the tests passing now in the PR above. Let me know what you think.