|
@ -6,7 +6,6 @@ from fastapi._compat import PYDANTIC_V2, PYDANTIC_VERSION |
|
|
from pydantic import BaseModel, Field |
|
|
from pydantic import BaseModel, Field |
|
|
from starlette.testclient import TestClient |
|
|
from starlette.testclient import TestClient |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app = FastAPI() |
|
|
app = FastAPI() |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -202,7 +201,10 @@ if PYDANTIC_V2: |
|
|
|
|
|
|
|
|
assert response.json() == expected_response |
|
|
assert response.json() == expected_response |
|
|
|
|
|
|
|
|
@pytest.mark.skipif(PYDANTIC_VERSION >= "2.7.3", reason="Pydantic supports the feature from this point on") |
|
|
@pytest.mark.skipif( |
|
|
|
|
|
PYDANTIC_VERSION >= "2.7.3", |
|
|
|
|
|
reason="Pydantic supports the feature from this point on", |
|
|
|
|
|
) |
|
|
def test_validdict_with_context__pre_pydantic_support(): |
|
|
def test_validdict_with_context__pre_pydantic_support(): |
|
|
response = client.get("/items/validdict-with-context") |
|
|
response = client.get("/items/validdict-with-context") |
|
|
response.raise_for_status() |
|
|
response.raise_for_status() |
|
@ -213,4 +215,4 @@ if PYDANTIC_V2: |
|
|
"k3": {"aliased_name": "baz", "owner_ids": [1, 2, 3], "secret": "sEcReT"}, |
|
|
"k3": {"aliased_name": "baz", "owner_ids": [1, 2, 3], "secret": "sEcReT"}, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
assert response.json() == expected_response |
|
|
assert response.json() == expected_response |
|
|