test_tutorial001.py — fastapi Source File
Architecture documentation for test_tutorial001.py, a python file in the fastapi codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 296c6a8b_3735_966c_aa9d_b6c236111a17["test_tutorial001.py"] 204176f9_0dc0_14d1_b58a_0e8b42891825["utils"] 296c6a8b_3735_966c_aa9d_b6c236111a17 --> 204176f9_0dc0_14d1_b58a_0e8b42891825 83e01a9c_50a9_bec9_6f86_8e729106de01["importlib"] 296c6a8b_3735_966c_aa9d_b6c236111a17 --> 83e01a9c_50a9_bec9_6f86_8e729106de01 fb2d9376_ca24_f2b2_f130_cc10e9f2e732["types"] 296c6a8b_3735_966c_aa9d_b6c236111a17 --> fb2d9376_ca24_f2b2_f130_cc10e9f2e732 5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"] 296c6a8b_3735_966c_aa9d_b6c236111a17 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9 style 296c6a8b_3735_966c_aa9d_b6c236111a17 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import importlib
from types import ModuleType
import pytest
from ...utils import needs_py310
@pytest.fixture(
name="test_module",
params=[
pytest.param("tutorial001_py39"),
pytest.param("tutorial001_py310", marks=needs_py310),
pytest.param("tutorial001_an_py39"),
pytest.param("tutorial001_an_py310", marks=needs_py310),
],
)
def get_test_module(request: pytest.FixtureRequest) -> ModuleType:
mod: ModuleType = importlib.import_module(
f"docs_src.dependency_testing.{request.param}"
)
return mod
def test_override_in_items_run(test_module: ModuleType):
test_override_in_items = test_module.test_override_in_items
test_override_in_items()
def test_override_in_items_with_q_run(test_module: ModuleType):
test_override_in_items_with_q = test_module.test_override_in_items_with_q
test_override_in_items_with_q()
def test_override_in_items_with_params_run(test_module: ModuleType):
test_override_in_items_with_params = test_module.test_override_in_items_with_params
test_override_in_items_with_params()
def test_override_in_users(test_module: ModuleType):
client = test_module.client
response = client.get("/users/")
assert response.status_code == 200, response.text
assert response.json() == {
"message": "Hello Users!",
"params": {"q": None, "skip": 5, "limit": 10},
}
def test_override_in_users_with_q(test_module: ModuleType):
client = test_module.client
response = client.get("/users/?q=foo")
assert response.status_code == 200, response.text
assert response.json() == {
"message": "Hello Users!",
"params": {"q": "foo", "skip": 5, "limit": 10},
}
def test_override_in_users_with_params(test_module: ModuleType):
client = test_module.client
response = client.get("/users/?q=foo&skip=100&limit=200")
assert response.status_code == 200, response.text
assert response.json() == {
"message": "Hello Users!",
"params": {"q": "foo", "skip": 5, "limit": 10},
}
def test_normal_app(test_module: ModuleType):
app = test_module.app
client = test_module.client
app.dependency_overrides = None
response = client.get("/items/?q=foo&skip=100&limit=200")
assert response.status_code == 200, response.text
assert response.json() == {
"message": "Hello Items!",
"params": {"q": "foo", "skip": 100, "limit": 200},
}
Domain
Subdomains
Functions
Dependencies
- importlib
- pytest
- types
- utils
Source
Frequently Asked Questions
What does test_tutorial001.py do?
test_tutorial001.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Responses subdomain.
What functions are defined in test_tutorial001.py?
test_tutorial001.py defines 8 function(s): get_test_module, test_normal_app, test_override_in_items_run, test_override_in_items_with_params_run, test_override_in_items_with_q_run, test_override_in_users, test_override_in_users_with_params, test_override_in_users_with_q.
What does test_tutorial001.py depend on?
test_tutorial001.py imports 4 module(s): importlib, pytest, types, utils.
Where is test_tutorial001.py in the architecture?
test_tutorial001.py is located at tests/test_tutorial/test_testing_dependencies/test_tutorial001.py (domain: FastAPI, subdomain: Responses, directory: tests/test_tutorial/test_testing_dependencies).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free