Skip to content

Commit 1396fce

Browse files
authored
Fix some pydantic 2.0 DeprecationWarnings (#289)
**Description:** The test suite is throwing many `DeprecationWarning`s and `UserWarning`s. This PR addresses only one class: a pydantic 2.0 `DeprecationWarning` caused by `.dict()` calls in the test suite itself. **PR Checklist:** - [x] Code is formatted and linted (run `pre-commit run --all-files`) - [x] Tests pass (run `make test`) - [ ] Documentation has been updated to reflect changes, if applicable - [ ] Changes are added to the changelog
1 parent 6fb8278 commit 1396fce

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

stac_fastapi/tests/clients/test_elasticsearch.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,11 @@ async def test_create_item(ctx, core_client, txn_client):
200200
resp = await core_client.get_item(
201201
ctx.item["id"], ctx.item["collection"], request=MockRequest
202202
)
203-
assert Item(**ctx.item).dict(
203+
assert Item(**ctx.item).model_dump(
204204
exclude={"links": ..., "properties": {"created", "updated"}}
205-
) == Item(**resp).dict(exclude={"links": ..., "properties": {"created", "updated"}})
205+
) == Item(**resp).model_dump(
206+
exclude={"links": ..., "properties": {"created", "updated"}}
207+
)
206208

207209

208210
@pytest.mark.asyncio

stac_fastapi/tests/resources/test_item.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ async def test_field_extension_exclude_default_includes(app_client, ctx):
804804
async def test_search_intersects_and_bbox(app_client):
805805
"""Test POST search intersects and bbox are mutually exclusive (core)"""
806806
bbox = [-118, 34, -117, 35]
807-
geoj = Polygon.from_bounds(*bbox).dict(exclude_none=True)
807+
geoj = Polygon.from_bounds(*bbox).model_dump(exclude_none=True)
808808
params = {"bbox": bbox, "intersects": geoj}
809809
resp = await app_client.post("/search", json=params)
810810
assert resp.status_code == 400

0 commit comments

Comments
 (0)