mirror of https://github.com/tiangolo/fastapi.git
Remove py39 code example
This commit is contained in:
parent
fc648a866b
commit
b7c1460755
|
|
@ -1,22 +0,0 @@
|
|||
from typing import Annotated, Union
|
||||
|
||||
from fastapi import FastAPI, Query
|
||||
from pydantic import BeforeValidator
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
def nullable_str(val: str) -> Union[str, None]:
|
||||
if val in ("None", "", "null"):
|
||||
return None
|
||||
return val
|
||||
|
||||
|
||||
@app.get("/items/")
|
||||
async def read_items(
|
||||
q: Annotated[Union[str, None], Query(min_length=3), BeforeValidator(nullable_str)],
|
||||
):
|
||||
results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
|
||||
if q:
|
||||
results.update({"q": q})
|
||||
return results
|
||||
|
|
@ -3,14 +3,11 @@ import importlib
|
|||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from ...utils import needs_py310
|
||||
|
||||
|
||||
@pytest.fixture(
|
||||
name="client",
|
||||
params=[
|
||||
pytest.param("tutorial006c_an_py39"),
|
||||
pytest.param("tutorial006c_an_py310", marks=needs_py310),
|
||||
"tutorial006c_an_py310",
|
||||
],
|
||||
)
|
||||
def get_client(request: pytest.FixtureRequest):
|
||||
|
|
|
|||
Loading…
Reference in New Issue