🔥 Remove Pydantic v1 specific test variants (#14611)

This commit is contained in:
Sebastián Ramírez
2025-12-27 10:19:10 -08:00
committed by GitHub
parent 8322a4445a
commit 44c849c4fc
104 changed files with 4139 additions and 8074 deletions

View File

@@ -1,7 +1,6 @@
import importlib
import pytest
from dirty_equals import IsDict
from fastapi.testclient import TestClient
from inline_snapshot import snapshot
@@ -54,30 +53,16 @@ def test_cookie_param_model_invalid(client: TestClient):
response = client.get("/items/")
assert response.status_code == 422
assert response.json() == snapshot(
IsDict(
{
"detail": [
{
"type": "missing",
"loc": ["cookie", "session_id"],
"msg": "Field required",
"input": {},
}
]
}
)
| IsDict(
# TODO: remove when deprecating Pydantic v1
{
"detail": [
{
"type": "value_error.missing",
"loc": ["cookie", "session_id"],
"msg": "field required",
}
]
}
)
{
"detail": [
{
"type": "missing",
"loc": ["cookie", "session_id"],
"msg": "Field required",
"input": {},
}
]
}
)
@@ -115,37 +100,19 @@ def test_openapi_schema(client: TestClient):
"name": "fatebook_tracker",
"in": "cookie",
"required": False,
"schema": IsDict(
{
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "Fatebook Tracker",
}
)
| IsDict(
# TODO: remove when deprecating Pydantic v1
{
"type": "string",
"title": "Fatebook Tracker",
}
),
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "Fatebook Tracker",
},
},
{
"name": "googall_tracker",
"in": "cookie",
"required": False,
"schema": IsDict(
{
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "Googall Tracker",
}
)
| IsDict(
# TODO: remove when deprecating Pydantic v1
{
"type": "string",
"title": "Googall Tracker",
}
),
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "Googall Tracker",
},
},
],
"responses": {

View File

@@ -1,7 +1,6 @@
import importlib
import pytest
from dirty_equals import IsDict
from fastapi.testclient import TestClient
from inline_snapshot import snapshot
@@ -72,30 +71,16 @@ def test_cookie_param_model_extra(client: TestClient):
response = c.get("/items/")
assert response.status_code == 422
assert response.json() == snapshot(
IsDict(
{
"detail": [
{
"type": "extra_forbidden",
"loc": ["cookie", "extra"],
"msg": "Extra inputs are not permitted",
"input": "track-me-here-too",
}
]
}
)
| IsDict(
# TODO: remove when deprecating Pydantic v1
{
"detail": [
{
"type": "value_error.extra",
"loc": ["cookie", "extra"],
"msg": "extra fields not permitted",
}
]
}
)
{
"detail": [
{
"type": "extra_forbidden",
"loc": ["cookie", "extra"],
"msg": "Extra inputs are not permitted",
"input": "track-me-here-too",
}
]
}
)
@@ -134,19 +119,10 @@ def test_openapi_schema(client: TestClient):
"name": "googall_tracker",
"in": "cookie",
"required": False,
"schema": IsDict(
{
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "Googall Tracker",
}
)
| IsDict(
# TODO: remove when deprecating Pydantic v1
{
"type": "string",
"title": "Googall Tracker",
}
),
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "Googall Tracker",
},
},
],
"responses": {