Home / File/ test_forms_from_non_typing_sequences.py — fastapi Source File

test_forms_from_non_typing_sequences.py — fastapi Source File

Architecture documentation for test_forms_from_non_typing_sequences.py, a python file in the fastapi codebase. 2 imports, 0 dependents.

File python FastAPI Applications 2 imports 6 functions

Entity Profile

Dependency Diagram

graph LR
  9c439ec9_ebd0_a54e_676e_e92df81f7942["test_forms_from_non_typing_sequences.py"]
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  9c439ec9_ebd0_a54e_676e_e92df81f7942 --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  9c439ec9_ebd0_a54e_676e_e92df81f7942 --> a7c04dee_ee23_5891_b185_47ff6bed036d
  style 9c439ec9_ebd0_a54e_676e_e92df81f7942 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from fastapi import FastAPI, Form
from fastapi.testclient import TestClient

app = FastAPI()


@app.post("/form/python-list")
def post_form_param_list(items: list = Form()):
    return items


@app.post("/form/python-set")
def post_form_param_set(items: set = Form()):
    return items


@app.post("/form/python-tuple")
def post_form_param_tuple(items: tuple = Form()):
    return items


client = TestClient(app)


def test_python_list_param_as_form():
    response = client.post(
        "/form/python-list", data={"items": ["first", "second", "third"]}
    )
    assert response.status_code == 200, response.text
    assert response.json() == ["first", "second", "third"]


def test_python_set_param_as_form():
    response = client.post(
        "/form/python-set", data={"items": ["first", "second", "third"]}
    )
    assert response.status_code == 200, response.text
    assert set(response.json()) == {"first", "second", "third"}


def test_python_tuple_param_as_form():
    response = client.post(
        "/form/python-tuple", data={"items": ["first", "second", "third"]}
    )
    assert response.status_code == 200, response.text
    assert response.json() == ["first", "second", "third"]

Domain

Subdomains

Frequently Asked Questions

What does test_forms_from_non_typing_sequences.py do?
test_forms_from_non_typing_sequences.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_forms_from_non_typing_sequences.py?
test_forms_from_non_typing_sequences.py defines 6 function(s): post_form_param_list, post_form_param_set, post_form_param_tuple, test_python_list_param_as_form, test_python_set_param_as_form, test_python_tuple_param_as_form.
What does test_forms_from_non_typing_sequences.py depend on?
test_forms_from_non_typing_sequences.py imports 2 module(s): __init__.py, testclient.py.
Where is test_forms_from_non_typing_sequences.py in the architecture?
test_forms_from_non_typing_sequences.py is located at tests/test_forms_from_non_typing_sequences.py (domain: FastAPI, subdomain: Applications, directory: tests).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free