Remove code examples for Python 3.8 in `separate_openapi_schemas`

This commit is contained in:
Yurii Motov 2025-12-11 19:54:06 +01:00
parent 680b8a0d16
commit 2e792112bb
4 changed files with 4 additions and 62 deletions

View File

@ -1,28 +0,0 @@
from typing import List, Union
from fastapi import FastAPI
from pydantic import BaseModel
class Item(BaseModel):
name: str
description: Union[str, None] = None
app = FastAPI()
@app.post("/items/")
def create_item(item: Item):
return item
@app.get("/items/")
def read_items() -> List[Item]:
return [
Item(
name="Portal Gun",
description="Device to travel through the multi-rick-verse",
),
Item(name="Plumbus"),
]

View File

@ -1,28 +0,0 @@
from typing import List, Union
from fastapi import FastAPI
from pydantic import BaseModel
class Item(BaseModel):
name: str
description: Union[str, None] = None
app = FastAPI(separate_input_output_schemas=False)
@app.post("/items/")
def create_item(item: Item):
return item
@app.get("/items/")
def read_items() -> List[Item]:
return [
Item(
name="Portal Gun",
description="Device to travel through the multi-rick-verse",
),
Item(name="Plumbus"),
]

View File

@ -3,15 +3,14 @@ import importlib
import pytest
from fastapi.testclient import TestClient
from ...utils import needs_py39, needs_py310, needs_pydanticv2
from ...utils import needs_py310, needs_pydanticv2
@pytest.fixture(
name="client",
params=[
"tutorial001",
pytest.param("tutorial001_py39"),
pytest.param("tutorial001_py310", marks=needs_py310),
pytest.param("tutorial001_py39", marks=needs_py39),
],
)
def get_client(request: pytest.FixtureRequest) -> TestClient:

View File

@ -3,15 +3,14 @@ import importlib
import pytest
from fastapi.testclient import TestClient
from ...utils import needs_py39, needs_py310, needs_pydanticv2
from ...utils import needs_py310, needs_pydanticv2
@pytest.fixture(
name="client",
params=[
"tutorial002",
pytest.param("tutorial002_py39"),
pytest.param("tutorial002_py310", marks=needs_py310),
pytest.param("tutorial002_py39", marks=needs_py39),
],
)
def get_client(request: pytest.FixtureRequest) -> TestClient: