Home / File/ test_general_performance.py — fastapi Source File

test_general_performance.py — fastapi Source File

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

File python FastAPI Responses 8 imports 47 functions 4 classes

Entity Profile

Dependency Diagram

graph LR
  f301437d_898d_b160_f85f_b6788c3d5890["test_general_performance.py"]
  c1ef60e8_e635_2e82_29e5_a79e03e975d6["json"]
  f301437d_898d_b160_f85f_b6788c3d5890 --> c1ef60e8_e635_2e82_29e5_a79e03e975d6
  65099b90_26c1_5db5_09e6_30dc0ea421e3["sys"]
  f301437d_898d_b160_f85f_b6788c3d5890 --> 65099b90_26c1_5db5_09e6_30dc0ea421e3
  07d79a2e_d4e9_0bbb_be90_936274444c8c["collections.abc"]
  f301437d_898d_b160_f85f_b6788c3d5890 --> 07d79a2e_d4e9_0bbb_be90_936274444c8c
  0dda2280_3359_8460_301c_e98c77e78185["typing"]
  f301437d_898d_b160_f85f_b6788c3d5890 --> 0dda2280_3359_8460_301c_e98c77e78185
  5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"]
  f301437d_898d_b160_f85f_b6788c3d5890 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  f301437d_898d_b160_f85f_b6788c3d5890 --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  f301437d_898d_b160_f85f_b6788c3d5890 --> a7c04dee_ee23_5891_b185_47ff6bed036d
  6913fbd4_39df_d14b_44bb_522e99b65b90["pydantic"]
  f301437d_898d_b160_f85f_b6788c3d5890 --> 6913fbd4_39df_d14b_44bb_522e99b65b90
  style f301437d_898d_b160_f85f_b6788c3d5890 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import json
import sys
from collections.abc import Iterator
from typing import Annotated, Any

import pytest
from fastapi import Depends, FastAPI
from fastapi.testclient import TestClient
from pydantic import BaseModel

if "--codspeed" not in sys.argv:
    pytest.skip(
        "Benchmark tests are skipped by default; run with --codspeed.",
        allow_module_level=True,
    )

LARGE_ITEMS: list[dict[str, Any]] = [
    {
        "id": i,
        "name": f"item-{i}",
        "values": list(range(25)),
        "meta": {
            "active": True,
            "group": i % 10,
            "tag": f"t{i % 5}",
        },
    }
    for i in range(300)
]

LARGE_METADATA: dict[str, Any] = {
    "source": "benchmark",
    "version": 1,
    "flags": {"a": True, "b": False, "c": True},
    "notes": ["x" * 50, "y" * 50, "z" * 50],
}

LARGE_PAYLOAD: dict[str, Any] = {"items": LARGE_ITEMS, "metadata": LARGE_METADATA}


def dep_a():
    return 40


def dep_b(a: Annotated[int, Depends(dep_a)]):
    return a + 2


class ItemIn(BaseModel):
    name: str
    value: int


class ItemOut(BaseModel):
    name: str
    value: int
    dep: int


class LargeIn(BaseModel):
// ... (340 more lines)

Domain

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does test_general_performance.py do?
test_general_performance.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_general_performance.py?
test_general_performance.py defines 47 function(s): _bench_get, _bench_post_json, _expected_large_payload_json_bytes, async_dict_no_response_model, async_dict_with_response_model, async_large_dict_no_response_model, async_large_dict_with_response_model, async_large_model_no_response_model, async_large_model_with_response_model, async_large_receive, and 37 more.
What does test_general_performance.py depend on?
test_general_performance.py imports 8 module(s): __init__.py, collections.abc, json, pydantic, pytest, sys, testclient.py, typing.
Where is test_general_performance.py in the architecture?
test_general_performance.py is located at tests/benchmarks/test_general_performance.py (domain: FastAPI, subdomain: Responses, directory: tests/benchmarks).

Analyze Your Own Codebase

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

Try Supermodel Free