🔥 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

@@ -2,7 +2,7 @@ import importlib
import warnings
import pytest
from dirty_equals import IsDict, IsInt
from dirty_equals import IsInt
from fastapi.testclient import TestClient
from inline_snapshot import snapshot
from sqlalchemy import StaticPool
@@ -318,33 +318,15 @@ def test_openapi_schema(client: TestClient):
},
"Hero": {
"properties": {
"id": IsDict(
{
"anyOf": [{"type": "integer"}, {"type": "null"}],
"title": "Id",
}
)
| IsDict(
# TODO: remove when deprecating Pydantic v1
{
"type": "integer",
"title": "Id",
}
),
"id": {
"anyOf": [{"type": "integer"}, {"type": "null"}],
"title": "Id",
},
"name": {"type": "string", "title": "Name"},
"age": IsDict(
{
"anyOf": [{"type": "integer"}, {"type": "null"}],
"title": "Age",
}
)
| IsDict(
# TODO: remove when deprecating Pydantic v1
{
"type": "integer",
"title": "Age",
}
),
"age": {
"anyOf": [{"type": "integer"}, {"type": "null"}],
"title": "Age",
},
"secret_name": {"type": "string", "title": "Secret Name"},
},
"type": "object",

View File

@@ -2,7 +2,7 @@ import importlib
import warnings
import pytest
from dirty_equals import IsDict, IsInt
from dirty_equals import IsInt
from fastapi.testclient import TestClient
from inline_snapshot import Is, snapshot
from sqlalchemy import StaticPool
@@ -373,19 +373,10 @@ def test_openapi_schema(client: TestClient):
"HeroCreate": {
"properties": {
"name": {"type": "string", "title": "Name"},
"age": IsDict(
{
"anyOf": [{"type": "integer"}, {"type": "null"}],
"title": "Age",
}
)
| IsDict(
# TODO: remove when deprecating Pydantic v1
{
"type": "integer",
"title": "Age",
}
),
"age": {
"anyOf": [{"type": "integer"}, {"type": "null"}],
"title": "Age",
},
"secret_name": {"type": "string", "title": "Secret Name"},
},
"type": "object",
@@ -395,19 +386,10 @@ def test_openapi_schema(client: TestClient):
"HeroPublic": {
"properties": {
"name": {"type": "string", "title": "Name"},
"age": IsDict(
{
"anyOf": [{"type": "integer"}, {"type": "null"}],
"title": "Age",
}
)
| IsDict(
# TODO: remove when deprecating Pydantic v1
{
"type": "integer",
"title": "Age",
}
),
"age": {
"anyOf": [{"type": "integer"}, {"type": "null"}],
"title": "Age",
},
"id": {"type": "integer", "title": "Id"},
},
"type": "object",
@@ -416,45 +398,18 @@ def test_openapi_schema(client: TestClient):
},
"HeroUpdate": {
"properties": {
"name": IsDict(
{
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "Name",
}
)
| IsDict(
# TODO: remove when deprecating Pydantic v1
{
"type": "string",
"title": "Name",
}
),
"age": IsDict(
{
"anyOf": [{"type": "integer"}, {"type": "null"}],
"title": "Age",
}
)
| IsDict(
# TODO: remove when deprecating Pydantic v1
{
"type": "integer",
"title": "Age",
}
),
"secret_name": IsDict(
{
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "Secret Name",
}
)
| IsDict(
# TODO: remove when deprecating Pydantic v1
{
"type": "string",
"title": "Secret Name",
}
),
"name": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "Name",
},
"age": {
"anyOf": [{"type": "integer"}, {"type": "null"}],
"title": "Age",
},
"secret_name": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "Secret Name",
},
},
"type": "object",
"title": "HeroUpdate",