test_tutorial015.py — fastapi Source File
Architecture documentation for test_tutorial015.py, a python file in the fastapi codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 4d63ef91_9f28_3ba0_a0b3_78a5cf06a3c0["test_tutorial015.py"] 7c9337ab_bdd3_aeb1_43c1_426234644799["utils"] 4d63ef91_9f28_3ba0_a0b3_78a5cf06a3c0 --> 7c9337ab_bdd3_aeb1_43c1_426234644799 83e01a9c_50a9_bec9_6f86_8e729106de01["importlib"] 4d63ef91_9f28_3ba0_a0b3_78a5cf06a3c0 --> 83e01a9c_50a9_bec9_6f86_8e729106de01 5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"] 4d63ef91_9f28_3ba0_a0b3_78a5cf06a3c0 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9 752ca3d8_e45b_84ed_d1a1_588cbc236b65["dirty_equals"] 4d63ef91_9f28_3ba0_a0b3_78a5cf06a3c0 --> 752ca3d8_e45b_84ed_d1a1_588cbc236b65 a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"] 4d63ef91_9f28_3ba0_a0b3_78a5cf06a3c0 --> a7c04dee_ee23_5891_b185_47ff6bed036d a7f4e7b0_9725_db90_5cbc_7ca8211b323a["inline_snapshot"] 4d63ef91_9f28_3ba0_a0b3_78a5cf06a3c0 --> a7f4e7b0_9725_db90_5cbc_7ca8211b323a style 4d63ef91_9f28_3ba0_a0b3_78a5cf06a3c0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import importlib
import pytest
from dirty_equals import IsStr
from fastapi.testclient import TestClient
from inline_snapshot import snapshot
from ...utils import needs_py310
@pytest.fixture(
name="client",
params=[
pytest.param("tutorial015_an_py39"),
pytest.param("tutorial015_an_py310", marks=[needs_py310]),
],
)
def get_client(request: pytest.FixtureRequest):
mod = importlib.import_module(
f"docs_src.query_params_str_validations.{request.param}"
)
client = TestClient(mod.app)
return client
def test_get_random_item(client: TestClient):
response = client.get("/items")
assert response.status_code == 200, response.text
assert response.json() == {"id": IsStr(), "name": IsStr()}
def test_get_item(client: TestClient):
response = client.get("/items?id=isbn-9781529046137")
assert response.status_code == 200, response.text
assert response.json() == {
"id": "isbn-9781529046137",
"name": "The Hitchhiker's Guide to the Galaxy",
}
def test_get_item_does_not_exist(client: TestClient):
response = client.get("/items?id=isbn-nope")
assert response.status_code == 200, response.text
assert response.json() == {"id": "isbn-nope", "name": None}
def test_get_invalid_item(client: TestClient):
response = client.get("/items?id=wtf-yes")
assert response.status_code == 422, response.text
assert response.json() == snapshot(
{
"detail": [
{
"type": "value_error",
"loc": ["query", "id"],
"msg": 'Value error, Invalid ID format, it must start with "isbn-" or "imdb-"',
"input": "wtf-yes",
"ctx": {"error": {}},
}
// ... (85 more lines)
Domain
Subdomains
Functions
Dependencies
- dirty_equals
- importlib
- inline_snapshot
- pytest
- testclient.py
- utils
Source
Frequently Asked Questions
What does test_tutorial015.py do?
test_tutorial015.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_tutorial015.py?
test_tutorial015.py defines 6 function(s): get_client, test_get_invalid_item, test_get_item, test_get_item_does_not_exist, test_get_random_item, test_openapi_schema.
What does test_tutorial015.py depend on?
test_tutorial015.py imports 6 module(s): dirty_equals, importlib, inline_snapshot, pytest, testclient.py, utils.
Where is test_tutorial015.py in the architecture?
test_tutorial015.py is located at tests/test_tutorial/test_query_params_str_validations/test_tutorial015.py (domain: FastAPI, subdomain: Responses, directory: tests/test_tutorial/test_query_params_str_validations).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free