Home / File/ test_typing_python39.py — fastapi Source File

test_typing_python39.py — fastapi Source File

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

File python FastAPI Applications 3 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  db11ce81_bd4c_f710_d256_3b64519b59d4["test_typing_python39.py"]
  8fd7072e_05b0_6622_0f14_e1e357032855["utils.py"]
  db11ce81_bd4c_f710_d256_3b64519b59d4 --> 8fd7072e_05b0_6622_0f14_e1e357032855
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  db11ce81_bd4c_f710_d256_3b64519b59d4 --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  db11ce81_bd4c_f710_d256_3b64519b59d4 --> a7c04dee_ee23_5891_b185_47ff6bed036d
  style db11ce81_bd4c_f710_d256_3b64519b59d4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from fastapi import FastAPI
from fastapi.testclient import TestClient

from .utils import needs_py310


@needs_py310
def test_typing():
    types = {
        list[int]: [1, 2, 3],
        dict[str, list[int]]: {"a": [1, 2, 3], "b": [4, 5, 6]},
        set[int]: [1, 2, 3],  # `set` is converted to `list`
        tuple[int, ...]: [1, 2, 3],  # `tuple` is converted to `list`
    }
    for test_type, expect in types.items():
        app = FastAPI()

        @app.post("/", response_model=test_type)
        def post_endpoint(input: test_type):
            return input

        res = TestClient(app).post("/", json=expect)
        assert res.status_code == 200, res.json()
        assert res.json() == expect

Domain

Subdomains

Functions

Frequently Asked Questions

What does test_typing_python39.py do?
test_typing_python39.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_typing_python39.py?
test_typing_python39.py defines 1 function(s): test_typing.
What does test_typing_python39.py depend on?
test_typing_python39.py imports 3 module(s): __init__.py, testclient.py, utils.py.
Where is test_typing_python39.py in the architecture?
test_typing_python39.py is located at tests/test_typing_python39.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