Browse Source

Remove Pydantic V1 TODOs

These tests are all marked `@needs_pydanticv2` so they don't run on
Pydantic V1.
pull/11542/head
Tamir Duberstein 1 week ago
parent
commit
37df0c2e4a
Failed to extract signature
  1. 29
      tests/test_filter_pydantic_sub_model_pv2.py

29
tests/test_filter_pydantic_sub_model_pv2.py

@ -1,7 +1,7 @@
from typing import Optional
import pytest
from dirty_equals import HasRepr, IsDict, IsOneOf
from dirty_equals import HasRepr, IsDict
from fastapi import Depends, FastAPI
from fastapi.exceptions import ResponseValidationError
from fastapi.testclient import TestClient
@ -68,14 +68,6 @@ def test_validator_is_cloned(client: TestClient):
"ctx": {"error": HasRepr("ValueError('name must end in A')")},
}
)
| IsDict(
# TODO remove when deprecating Pydantic v1
{
"loc": ("response", "name"),
"msg": "name must end in A",
"type": "value_error",
}
)
]
@ -137,23 +129,14 @@ def test_openapi_schema(client: TestClient):
},
"ModelA": {
"title": "ModelA",
"required": IsOneOf(
["name", "description", "foo"],
# TODO remove when deprecating Pydantic v1
["name", "foo"],
),
"required": ["name", "foo"],
"type": "object",
"properties": {
"name": {"title": "Name", "type": "string"},
"description": IsDict(
{
"title": "Description",
"anyOf": [{"type": "string"}, {"type": "null"}],
}
)
|
# TODO remove when deprecating Pydantic v1
IsDict({"title": "Description", "type": "string"}),
"description": {
"title": "Description",
"anyOf": [{"type": "string"}, {"type": "null"}],
},
"foo": {"$ref": "#/components/schemas/ModelB"},
},
},

Loading…
Cancel
Save