mirror of https://github.com/tiangolo/fastapi.git
Remove code examples for Python 3.8 in `cookie_param_models`
This commit is contained in:
parent
fcf8a424b7
commit
37f3865910
|
|
@ -1,18 +0,0 @@
|
|||
from typing import Union
|
||||
|
||||
from fastapi import Cookie, FastAPI
|
||||
from pydantic import BaseModel
|
||||
from typing_extensions import Annotated
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
class Cookies(BaseModel):
|
||||
session_id: str
|
||||
fatebook_tracker: Union[str, None] = None
|
||||
googall_tracker: Union[str, None] = None
|
||||
|
||||
|
||||
@app.get("/items/")
|
||||
async def read_items(cookies: Annotated[Cookies, Cookie()]):
|
||||
return cookies
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
from typing import Union
|
||||
|
||||
from fastapi import Cookie, FastAPI
|
||||
from pydantic import BaseModel
|
||||
from typing_extensions import Annotated
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
class Cookies(BaseModel):
|
||||
model_config = {"extra": "forbid"}
|
||||
|
||||
session_id: str
|
||||
fatebook_tracker: Union[str, None] = None
|
||||
googall_tracker: Union[str, None] = None
|
||||
|
||||
|
||||
@app.get("/items/")
|
||||
async def read_items(cookies: Annotated[Cookies, Cookie()]):
|
||||
return cookies
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
from typing import Union
|
||||
|
||||
from fastapi import Cookie, FastAPI
|
||||
from pydantic import BaseModel
|
||||
from typing_extensions import Annotated
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
class Cookies(BaseModel):
|
||||
class Config:
|
||||
extra = "forbid"
|
||||
|
||||
session_id: str
|
||||
fatebook_tracker: Union[str, None] = None
|
||||
googall_tracker: Union[str, None] = None
|
||||
|
||||
|
||||
@app.get("/items/")
|
||||
async def read_items(cookies: Annotated[Cookies, Cookie()]):
|
||||
return cookies
|
||||
|
|
@ -5,16 +5,15 @@ from dirty_equals import IsDict
|
|||
from fastapi.testclient import TestClient
|
||||
from inline_snapshot import snapshot
|
||||
|
||||
from tests.utils import needs_py39, needs_py310
|
||||
from tests.utils import needs_py310
|
||||
|
||||
|
||||
@pytest.fixture(
|
||||
name="client",
|
||||
params=[
|
||||
"tutorial001",
|
||||
"tutorial001_py39",
|
||||
pytest.param("tutorial001_py310", marks=needs_py310),
|
||||
"tutorial001_an",
|
||||
pytest.param("tutorial001_an_py39", marks=needs_py39),
|
||||
"tutorial001_an_py39",
|
||||
pytest.param("tutorial001_an_py310", marks=needs_py310),
|
||||
],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ from fastapi.testclient import TestClient
|
|||
from inline_snapshot import snapshot
|
||||
|
||||
from tests.utils import (
|
||||
needs_py39,
|
||||
needs_py310,
|
||||
needs_pydanticv1,
|
||||
needs_pydanticv2,
|
||||
|
|
@ -17,15 +16,13 @@ from tests.utils import (
|
|||
@pytest.fixture(
|
||||
name="client",
|
||||
params=[
|
||||
pytest.param("tutorial002", marks=needs_pydanticv2),
|
||||
pytest.param("tutorial002_py39", marks=needs_pydanticv2),
|
||||
pytest.param("tutorial002_py310", marks=[needs_py310, needs_pydanticv2]),
|
||||
pytest.param("tutorial002_an", marks=needs_pydanticv2),
|
||||
pytest.param("tutorial002_an_py39", marks=[needs_py39, needs_pydanticv2]),
|
||||
pytest.param("tutorial002_an_py39", marks=needs_pydanticv2),
|
||||
pytest.param("tutorial002_an_py310", marks=[needs_py310, needs_pydanticv2]),
|
||||
pytest.param("tutorial002_pv1", marks=[needs_pydanticv1, needs_pydanticv1]),
|
||||
pytest.param("tutorial002_pv1_py39", marks=needs_pydanticv1),
|
||||
pytest.param("tutorial002_pv1_py310", marks=[needs_py310, needs_pydanticv1]),
|
||||
pytest.param("tutorial002_pv1_an", marks=[needs_pydanticv1]),
|
||||
pytest.param("tutorial002_pv1_an_py39", marks=[needs_py39, needs_pydanticv1]),
|
||||
pytest.param("tutorial002_pv1_an_py39", marks=needs_pydanticv1),
|
||||
pytest.param("tutorial002_pv1_an_py310", marks=[needs_py310, needs_pydanticv1]),
|
||||
],
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue