test_tutorial006.py — fastapi Source File
Architecture documentation for test_tutorial006.py, a python file in the fastapi codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 449e6834_44d3_2cc8_b8be_406b97d850ca["test_tutorial006.py"] 5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"] 449e6834_44d3_2cc8_b8be_406b97d850ca --> 5befe8bf_65d1_d058_6b78_4a597a8488e9 a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"] 449e6834_44d3_2cc8_b8be_406b97d850ca --> a7c04dee_ee23_5891_b185_47ff6bed036d a7f4e7b0_9725_db90_5cbc_7ca8211b323a["inline_snapshot"] 449e6834_44d3_2cc8_b8be_406b97d850ca --> a7f4e7b0_9725_db90_5cbc_7ca8211b323a 427b282f_3de7_d633_9207_f2d911d31dfc["tutorial006_py39.py"] 449e6834_44d3_2cc8_b8be_406b97d850ca --> 427b282f_3de7_d633_9207_f2d911d31dfc style 449e6834_44d3_2cc8_b8be_406b97d850ca fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import pytest
from fastapi.testclient import TestClient
from inline_snapshot import snapshot
from docs_src.path_operation_configuration.tutorial006_py39 import app
client = TestClient(app)
@pytest.mark.parametrize(
"path,expected_status,expected_response",
[
("/items/", 200, [{"name": "Foo", "price": 42}]),
("/users/", 200, [{"username": "johndoe"}]),
("/elements/", 200, [{"item_id": "Foo"}]),
],
)
def test_query_params_str_validations(path, expected_status, expected_response):
response = client.get(path)
assert response.status_code == expected_status
assert response.json() == expected_response
def test_openapi_schema():
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": {}}},
}
},
"tags": ["items"],
"summary": "Read Items",
"operationId": "read_items_items__get",
}
},
"/users/": {
"get": {
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
}
},
"tags": ["users"],
"summary": "Read Users",
"operationId": "read_users_users__get",
}
},
"/elements/": {
"get": {
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
}
},
"tags": ["items"],
"summary": "Read Elements",
"operationId": "read_elements_elements__get",
"deprecated": True,
}
},
},
}
)
Domain
Subdomains
Dependencies
- inline_snapshot
- pytest
- testclient.py
- tutorial006_py39.py
Source
Frequently Asked Questions
What does test_tutorial006.py do?
test_tutorial006.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Applications subdomain.
What functions are defined in test_tutorial006.py?
test_tutorial006.py defines 2 function(s): test_openapi_schema, test_query_params_str_validations.
What does test_tutorial006.py depend on?
test_tutorial006.py imports 4 module(s): inline_snapshot, pytest, testclient.py, tutorial006_py39.py.
Where is test_tutorial006.py in the architecture?
test_tutorial006.py is located at tests/test_tutorial/test_path_operation_configurations/test_tutorial006.py (domain: FastAPI, subdomain: Applications, directory: tests/test_tutorial/test_path_operation_configurations).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free