mirror of https://github.com/tiangolo/fastapi.git
Remove code examples for Python 3.8 in `extra_models`
This commit is contained in:
parent
4603f23b79
commit
5b81a4ba3e
|
|
@ -1,22 +0,0 @@
|
||||||
from typing import List
|
|
||||||
|
|
||||||
from fastapi import FastAPI
|
|
||||||
from pydantic import BaseModel
|
|
||||||
|
|
||||||
app = FastAPI()
|
|
||||||
|
|
||||||
|
|
||||||
class Item(BaseModel):
|
|
||||||
name: str
|
|
||||||
description: str
|
|
||||||
|
|
||||||
|
|
||||||
items = [
|
|
||||||
{"name": "Foo", "description": "There comes my hero"},
|
|
||||||
{"name": "Red", "description": "It's my aeroplane"},
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/items/", response_model=List[Item])
|
|
||||||
async def read_items():
|
|
||||||
return items
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
from typing import Dict
|
|
||||||
|
|
||||||
from fastapi import FastAPI
|
|
||||||
|
|
||||||
app = FastAPI()
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/keyword-weights/", response_model=Dict[str, float])
|
|
||||||
async def read_keyword_weights():
|
|
||||||
return {"foo": 2.3, "bar": 3.4}
|
|
||||||
|
|
@ -10,7 +10,7 @@ from ...utils import needs_py310
|
||||||
@pytest.fixture(
|
@pytest.fixture(
|
||||||
name="client",
|
name="client",
|
||||||
params=[
|
params=[
|
||||||
"tutorial003",
|
pytest.param("tutorial003_py39"),
|
||||||
pytest.param("tutorial003_py310", marks=needs_py310),
|
pytest.param("tutorial003_py310", marks=needs_py310),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,11 @@ import importlib
|
||||||
import pytest
|
import pytest
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
|
|
||||||
from ...utils import needs_py39
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(
|
@pytest.fixture(
|
||||||
name="client",
|
name="client",
|
||||||
params=[
|
params=[
|
||||||
"tutorial004",
|
pytest.param("tutorial004_py39"),
|
||||||
pytest.param("tutorial004_py39", marks=needs_py39),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def get_client(request: pytest.FixtureRequest):
|
def get_client(request: pytest.FixtureRequest):
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,11 @@ import importlib
|
||||||
import pytest
|
import pytest
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
|
|
||||||
from ...utils import needs_py39
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(
|
@pytest.fixture(
|
||||||
name="client",
|
name="client",
|
||||||
params=[
|
params=[
|
||||||
"tutorial005",
|
pytest.param("tutorial005_py39"),
|
||||||
pytest.param("tutorial005_py39", marks=needs_py39),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def get_client(request: pytest.FixtureRequest):
|
def get_client(request: pytest.FixtureRequest):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue