test_tutorial002.py — fastapi Source File
Architecture documentation for test_tutorial002.py, a python file in the fastapi codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 3d07da40_9cf3_7fa4_4d1f_ca71992f426f["test_tutorial002.py"] 5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"] 3d07da40_9cf3_7fa4_4d1f_ca71992f426f --> 5befe8bf_65d1_d058_6b78_4a597a8488e9 534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"] 3d07da40_9cf3_7fa4_4d1f_ca71992f426f --> 534f6e44_61b8_3c38_8b89_6934a6df9802 a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"] 3d07da40_9cf3_7fa4_4d1f_ca71992f426f --> a7c04dee_ee23_5891_b185_47ff6bed036d a7f4e7b0_9725_db90_5cbc_7ca8211b323a["inline_snapshot"] 3d07da40_9cf3_7fa4_4d1f_ca71992f426f --> a7f4e7b0_9725_db90_5cbc_7ca8211b323a 25b39639_b195_8683_4d68_c503205d79e6["tutorial002_py39.py"] 3d07da40_9cf3_7fa4_4d1f_ca71992f426f --> 25b39639_b195_8683_4d68_c503205d79e6 style 3d07da40_9cf3_7fa4_4d1f_ca71992f426f 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.tutorial002_py39 import app
yield app
def test_events(app: FastAPI):
with TestClient(app) as client:
response = client.get("/items/")
assert response.status_code == 200, response.text
assert response.json() == [{"name": "Foo"}]
with open("log.txt") as log:
assert "Application shutdown" in log.read()
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/": {
"get": {
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
}
},
"summary": "Read Items",
"operationId": "read_items_items__get",
}
}
},
}
)
Domain
Subdomains
Dependencies
- __init__.py
- inline_snapshot
- pytest
- testclient.py
- tutorial002_py39.py
Source
Frequently Asked Questions
What does test_tutorial002.py do?
test_tutorial002.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_tutorial002.py?
test_tutorial002.py defines 3 function(s): get_app, test_events, test_openapi_schema.
What does test_tutorial002.py depend on?
test_tutorial002.py imports 5 module(s): __init__.py, inline_snapshot, pytest, testclient.py, tutorial002_py39.py.
Where is test_tutorial002.py in the architecture?
test_tutorial002.py is located at tests/test_tutorial/test_events/test_tutorial002.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