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 2 weeks ago
parent
commit
37df0c2e4a
Failed to extract signature
  1. 25
      tests/test_filter_pydantic_sub_model_pv2.py

25
tests/test_filter_pydantic_sub_model_pv2.py

@ -1,7 +1,7 @@
from typing import Optional from typing import Optional
import pytest import pytest
from dirty_equals import HasRepr, IsDict, IsOneOf from dirty_equals import HasRepr, IsDict
from fastapi import Depends, FastAPI from fastapi import Depends, FastAPI
from fastapi.exceptions import ResponseValidationError from fastapi.exceptions import ResponseValidationError
from fastapi.testclient import TestClient 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')")}, "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": { "ModelA": {
"title": "ModelA", "title": "ModelA",
"required": IsOneOf( "required": ["name", "foo"],
["name", "description", "foo"],
# TODO remove when deprecating Pydantic v1
["name", "foo"],
),
"type": "object", "type": "object",
"properties": { "properties": {
"name": {"title": "Name", "type": "string"}, "name": {"title": "Name", "type": "string"},
"description": IsDict( "description": {
{
"title": "Description", "title": "Description",
"anyOf": [{"type": "string"}, {"type": "null"}], "anyOf": [{"type": "string"}, {"type": "null"}],
} },
)
|
# TODO remove when deprecating Pydantic v1
IsDict({"title": "Description", "type": "string"}),
"foo": {"$ref": "#/components/schemas/ModelB"}, "foo": {"$ref": "#/components/schemas/ModelB"},
}, },
}, },

Loading…
Cancel
Save