test_tutorial001.py — fastapi Source File
Architecture documentation for test_tutorial001.py, a python file in the fastapi codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 66196bd4_ad1d_d0dc_c76d_eb31972bb940["test_tutorial001.py"] 5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"] 66196bd4_ad1d_d0dc_c76d_eb31972bb940 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9 534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"] 66196bd4_ad1d_d0dc_c76d_eb31972bb940 --> 534f6e44_61b8_3c38_8b89_6934a6df9802 a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"] 66196bd4_ad1d_d0dc_c76d_eb31972bb940 --> a7c04dee_ee23_5891_b185_47ff6bed036d a7f4e7b0_9725_db90_5cbc_7ca8211b323a["inline_snapshot"] 66196bd4_ad1d_d0dc_c76d_eb31972bb940 --> a7f4e7b0_9725_db90_5cbc_7ca8211b323a b86a55b8_4208_c7f9_9d9c_e889d54cfa54["tutorial001_py39.py"] 66196bd4_ad1d_d0dc_c76d_eb31972bb940 --> b86a55b8_4208_c7f9_9d9c_e889d54cfa54 style 66196bd4_ad1d_d0dc_c76d_eb31972bb940 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import pytest
from fastapi import FastAPI
from fastapi.testclient import TestClient
from inline_snapshot import snapshot
@pytest.fixture(name="app", scope="module")
def get_app():
with pytest.warns(DeprecationWarning):
from docs_src.events.tutorial001_py39 import app
yield app
def test_events(app: FastAPI):
with TestClient(app) as client:
response = client.get("/items/foo")
assert response.status_code == 200, response.text
assert response.json() == {"name": "Fighters"}
def test_openapi_schema(app: FastAPI):
with TestClient(app) as client:
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == snapshot(
{
"openapi": "3.1.0",
"info": {"title": "FastAPI", "version": "0.1.0"},
"paths": {
"/items/{item_id}": {
"get": {
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
"summary": "Read Items",
"operationId": "read_items_items__item_id__get",
"parameters": [
{
"required": True,
"schema": {"title": "Item Id", "type": "string"},
"name": "item_id",
"in": "path",
}
],
}
}
},
"components": {
"schemas": {
"ValidationError": {
"title": "ValidationError",
"required": ["loc", "msg", "type"],
"type": "object",
"properties": {
"ctx": {"title": "Context", "type": "object"},
"input": {"title": "Input"},
"loc": {
"title": "Location",
"type": "array",
"items": {
"anyOf": [
{"type": "string"},
{"type": "integer"},
]
},
},
"msg": {"title": "Message", "type": "string"},
"type": {"title": "Error Type", "type": "string"},
},
},
"HTTPValidationError": {
"title": "HTTPValidationError",
"type": "object",
"properties": {
"detail": {
"title": "Detail",
"type": "array",
"items": {
"$ref": "#/components/schemas/ValidationError"
},
}
},
},
}
},
}
)
Domain
Subdomains
Dependencies
- __init__.py
- inline_snapshot
- pytest
- testclient.py
- tutorial001_py39.py
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, Routing subdomain.
What functions are defined in test_tutorial001.py?
test_tutorial001.py defines 3 function(s): get_app, test_events, test_openapi_schema.
What does test_tutorial001.py depend on?
test_tutorial001.py imports 5 module(s): __init__.py, inline_snapshot, pytest, testclient.py, tutorial001_py39.py.
Where is test_tutorial001.py in the architecture?
test_tutorial001.py is located at tests/test_tutorial/test_events/test_tutorial001.py (domain: FastAPI, subdomain: Routing, directory: tests/test_tutorial/test_events).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free