test_tutorial007.py — fastapi Source File
Architecture documentation for test_tutorial007.py, a python file in the fastapi codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR f0c3008c_16d3_2093_b7b7_776ef2354a86["test_tutorial007.py"] 772c78ef_aafa_0328_92af_34281be7cbc2["asyncio"] f0c3008c_16d3_2093_b7b7_776ef2354a86 --> 772c78ef_aafa_0328_92af_34281be7cbc2 a88eb002_9197_73f3_410d_ee5315767f34["contextlib"] f0c3008c_16d3_2093_b7b7_776ef2354a86 --> a88eb002_9197_73f3_410d_ee5315767f34 d1bf66df_8a92_7a7c_dab4_0865060effa4["unittest.mock"] f0c3008c_16d3_2093_b7b7_776ef2354a86 --> d1bf66df_8a92_7a7c_dab4_0865060effa4 cac969a5_77fd_093d_0535_017143e93509["tutorial007_py39.py"] f0c3008c_16d3_2093_b7b7_776ef2354a86 --> cac969a5_77fd_093d_0535_017143e93509 d8d284aa_6b67_6ad7_49c5_88687288e940["get_db"] f0c3008c_16d3_2093_b7b7_776ef2354a86 --> d8d284aa_6b67_6ad7_49c5_88687288e940 style f0c3008c_16d3_2093_b7b7_776ef2354a86 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import asyncio
from contextlib import asynccontextmanager
from unittest.mock import Mock, patch
from docs_src.dependencies.tutorial007_py39 import get_db
def test_get_db(): # Just for coverage
async def test_async_gen():
cm = asynccontextmanager(get_db)
async with cm() as db_session:
return db_session
dbsession_moock = Mock()
with patch(
"docs_src.dependencies.tutorial007_py39.DBSession",
return_value=dbsession_moock,
create=True,
):
value = asyncio.run(test_async_gen())
assert value is dbsession_moock
dbsession_moock.close.assert_called_once()
Domain
Subdomains
Functions
Dependencies
- asyncio
- contextlib
- get_db
- tutorial007_py39.py
- unittest.mock
Source
Frequently Asked Questions
What does test_tutorial007.py do?
test_tutorial007.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_tutorial007.py?
test_tutorial007.py defines 1 function(s): test_get_db.
What does test_tutorial007.py depend on?
test_tutorial007.py imports 5 module(s): asyncio, contextlib, get_db, tutorial007_py39.py, unittest.mock.
Where is test_tutorial007.py in the architecture?
test_tutorial007.py is located at tests/test_tutorial/test_dependencies/test_tutorial007.py (domain: FastAPI, subdomain: Responses, directory: tests/test_tutorial/test_dependencies).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free