test_form_default.py — fastapi Source File
Architecture documentation for test_form_default.py, a python file in the fastapi codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 304a426f_8dc7_8c1a_4125_7f5c3c9cf487["test_form_default.py"] 0dda2280_3359_8460_301c_e98c77e78185["typing"] 304a426f_8dc7_8c1a_4125_7f5c3c9cf487 --> 0dda2280_3359_8460_301c_e98c77e78185 534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"] 304a426f_8dc7_8c1a_4125_7f5c3c9cf487 --> 534f6e44_61b8_3c38_8b89_6934a6df9802 bcc067f0_0107_d76b_204a_6705d20b4cf9["starlette.testclient"] 304a426f_8dc7_8c1a_4125_7f5c3c9cf487 --> bcc067f0_0107_d76b_204a_6705d20b4cf9 style 304a426f_8dc7_8c1a_4125_7f5c3c9cf487 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from typing import Annotated, Optional
from fastapi import FastAPI, File, Form
from starlette.testclient import TestClient
app = FastAPI()
@app.post("/urlencoded")
async def post_url_encoded(age: Annotated[Optional[int], Form()] = None):
return age
@app.post("/multipart")
async def post_multi_part(
age: Annotated[Optional[int], Form()] = None,
file: Annotated[Optional[bytes], File()] = None,
):
return {"file": file, "age": age}
client = TestClient(app)
def test_form_default_url_encoded():
response = client.post("/urlencoded", data={"age": ""})
assert response.status_code == 200
assert response.text == "null"
def test_form_default_multi_part():
response = client.post("/multipart", data={"age": ""})
assert response.status_code == 200
assert response.json() == {"file": None, "age": None}
Domain
Subdomains
Functions
Dependencies
- __init__.py
- starlette.testclient
- typing
Source
Frequently Asked Questions
What does test_form_default.py do?
test_form_default.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_form_default.py?
test_form_default.py defines 4 function(s): post_multi_part, post_url_encoded, test_form_default_multi_part, test_form_default_url_encoded.
What does test_form_default.py depend on?
test_form_default.py imports 3 module(s): __init__.py, starlette.testclient, typing.
Where is test_form_default.py in the architecture?
test_form_default.py is located at tests/test_form_default.py (domain: FastAPI, subdomain: Responses, directory: tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free