mirror of https://github.com/tiangolo/fastapi.git
Remove code examples for Python 3.8 in `request_form_models`
This commit is contained in:
parent
965b58c5cd
commit
9589fd6864
|
|
@ -1,15 +0,0 @@
|
|||
from fastapi import FastAPI, Form
|
||||
from pydantic import BaseModel
|
||||
from typing_extensions import Annotated
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
class FormData(BaseModel):
|
||||
username: str
|
||||
password: str
|
||||
|
||||
|
||||
@app.post("/login/")
|
||||
async def login(data: Annotated[FormData, Form()]):
|
||||
return data
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
from fastapi import FastAPI, Form
|
||||
from pydantic import BaseModel
|
||||
from typing_extensions import Annotated
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
class FormData(BaseModel):
|
||||
username: str
|
||||
password: str
|
||||
model_config = {"extra": "forbid"}
|
||||
|
||||
|
||||
@app.post("/login/")
|
||||
async def login(data: Annotated[FormData, Form()]):
|
||||
return data
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
from fastapi import FastAPI, Form
|
||||
from pydantic import BaseModel
|
||||
from typing_extensions import Annotated
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
class FormData(BaseModel):
|
||||
username: str
|
||||
password: str
|
||||
|
||||
class Config:
|
||||
extra = "forbid"
|
||||
|
||||
|
||||
@app.post("/login/")
|
||||
async def login(data: Annotated[FormData, Form()]):
|
||||
return data
|
||||
|
|
@ -4,15 +4,12 @@ import pytest
|
|||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from ...utils import needs_py39
|
||||
|
||||
|
||||
@pytest.fixture(
|
||||
name="client",
|
||||
params=[
|
||||
"tutorial001",
|
||||
"tutorial001_an",
|
||||
pytest.param("tutorial001_an_py39", marks=needs_py39),
|
||||
"tutorial001_py39",
|
||||
"tutorial001_an_py39",
|
||||
],
|
||||
)
|
||||
def get_client(request: pytest.FixtureRequest):
|
||||
|
|
|
|||
|
|
@ -3,15 +3,14 @@ import importlib
|
|||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from ...utils import needs_py39, needs_pydanticv2
|
||||
from ...utils import needs_pydanticv2
|
||||
|
||||
|
||||
@pytest.fixture(
|
||||
name="client",
|
||||
params=[
|
||||
"tutorial002",
|
||||
"tutorial002_an",
|
||||
pytest.param("tutorial002_an_py39", marks=needs_py39),
|
||||
"tutorial002_py39",
|
||||
"tutorial002_an_py39",
|
||||
],
|
||||
)
|
||||
def get_client(request: pytest.FixtureRequest):
|
||||
|
|
|
|||
|
|
@ -3,15 +3,14 @@ import importlib
|
|||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from ...utils import needs_py39, needs_pydanticv1
|
||||
from ...utils import needs_pydanticv1
|
||||
|
||||
|
||||
@pytest.fixture(
|
||||
name="client",
|
||||
params=[
|
||||
"tutorial002_pv1",
|
||||
"tutorial002_pv1_an",
|
||||
pytest.param("tutorial002_pv1_an_py39", marks=needs_py39),
|
||||
"tutorial002_pv1_py39",
|
||||
"tutorial002_pv1_an_py39",
|
||||
],
|
||||
)
|
||||
def get_client(request: pytest.FixtureRequest):
|
||||
|
|
|
|||
Loading…
Reference in New Issue