Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions tests/test_tutorial/test_extra_data_types/test_tutorial001.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
import importlib

import pytest
from dirty_equals import IsDict
from fastapi.testclient import TestClient

from docs_src.extra_data_types.tutorial001 import app
from ...utils import needs_py39, needs_py310


@pytest.fixture(
name="client",
params=[
"tutorial001",
pytest.param("tutorial001_py310", marks=needs_py310),
"tutorial001_an",
pytest.param("tutorial001_an_py39", marks=needs_py39),
pytest.param("tutorial001_an_py310", marks=needs_py310),
],
)
def get_client(request: pytest.FixtureRequest):
mod = importlib.import_module(f"docs_src.extra_data_types.{request.param}")

client = TestClient(app)
client = TestClient(mod.app)
return client


def test_extra_types():
def test_extra_types(client: TestClient):
item_id = "ff97dd87-a4a5-4a12-b412-cde99f33e00e"
data = {
"start_datetime": "2018-12-22T14:00:00+00:00",
Expand All @@ -27,7 +45,7 @@ def test_extra_types():
assert response.json() == expected_response


def test_openapi_schema():
def test_openapi_schema(client: TestClient):
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == {
Expand Down
175 changes: 0 additions & 175 deletions tests/test_tutorial/test_extra_data_types/test_tutorial001_an.py

This file was deleted.

Loading