From 94aa386bcdfbef6fb54be2ff87716c611e5471a7 Mon Sep 17 00:00:00 2001 From: Yurii Motov Date: Tue, 16 Dec 2025 09:33:59 +0100 Subject: [PATCH] Add test for `docs_src.dependencies.tutorial001_02.py` --- ....py => test_tutorial001_tutorial001_02.py} | 36 ++++++++----------- 1 file changed, 14 insertions(+), 22 deletions(-) rename tests/test_tutorial/test_dependencies/{test_tutorial001.py => test_tutorial001_tutorial001_02.py} (86%) diff --git a/tests/test_tutorial/test_dependencies/test_tutorial001.py b/tests/test_tutorial/test_dependencies/test_tutorial001_tutorial001_02.py similarity index 86% rename from tests/test_tutorial/test_dependencies/test_tutorial001.py rename to tests/test_tutorial/test_dependencies/test_tutorial001_tutorial001_02.py index ed9944912..c6d349f0d 100644 --- a/tests/test_tutorial/test_dependencies/test_tutorial001.py +++ b/tests/test_tutorial/test_dependencies/test_tutorial001_tutorial001_02.py @@ -1,10 +1,11 @@ import importlib import pytest -from dirty_equals import IsDict from fastapi.testclient import TestClient -from ...utils import needs_py39, needs_py310 +from ...utils import needs_py39, needs_py310, needs_pydanticv2 + +skip_for_pydantic_v1 = needs_pydanticv2 @pytest.fixture( @@ -15,6 +16,9 @@ from ...utils import needs_py39, needs_py310 "tutorial001_an", pytest.param("tutorial001_an_py39", marks=needs_py39), pytest.param("tutorial001_an_py310", marks=needs_py310), + "tutorial001_02_an", + pytest.param("tutorial001_02_an_py39", marks=needs_py39), + pytest.param("tutorial001_02_an_py310", marks=needs_py310), ], ) def get_client(request: pytest.FixtureRequest): @@ -70,16 +74,10 @@ def test_openapi_schema(client: TestClient): "parameters": [ { "required": False, - "schema": IsDict( - { - "anyOf": [{"type": "string"}, {"type": "null"}], - "title": "Q", - } - ) - | IsDict( - # TODO: remove when deprecating Pydantic v1 - {"title": "Q", "type": "string"} - ), + "schema": { + "anyOf": [{"type": "string"}, {"type": "null"}], + "title": "Q", + }, "name": "q", "in": "query", }, @@ -129,16 +127,10 @@ def test_openapi_schema(client: TestClient): "parameters": [ { "required": False, - "schema": IsDict( - { - "anyOf": [{"type": "string"}, {"type": "null"}], - "title": "Q", - } - ) - | IsDict( - # TODO: remove when deprecating Pydantic v1 - {"title": "Q", "type": "string"} - ), + "schema": { + "anyOf": [{"type": "string"}, {"type": "null"}], + "title": "Q", + }, "name": "q", "in": "query", },