mirror of https://github.com/tiangolo/fastapi.git
Remove code examples for Python 3.8 in `additional_status_codes`
This commit is contained in:
parent
2e6de5cd04
commit
d990400c09
|
|
@ -1,26 +0,0 @@
|
|||
from typing import Union
|
||||
|
||||
from fastapi import Body, FastAPI, status
|
||||
from fastapi.responses import JSONResponse
|
||||
from typing_extensions import Annotated
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}}
|
||||
|
||||
|
||||
@app.put("/items/{item_id}")
|
||||
async def upsert_item(
|
||||
item_id: str,
|
||||
name: Annotated[Union[str, None], Body()] = None,
|
||||
size: Annotated[Union[int, None], Body()] = None,
|
||||
):
|
||||
if item_id in items:
|
||||
item = items[item_id]
|
||||
item["name"] = name
|
||||
item["size"] = size
|
||||
return item
|
||||
else:
|
||||
item = {"name": name, "size": size}
|
||||
items[item_id] = item
|
||||
return JSONResponse(status_code=status.HTTP_201_CREATED, content=item)
|
||||
|
|
@ -3,16 +3,15 @@ import importlib
|
|||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from ...utils import needs_py39, needs_py310
|
||||
from ...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),
|
||||
],
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue