Home / File/ test_list.py — fastapi Source File

test_list.py — fastapi Source File

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

File python FastAPI Routing 6 imports 24 functions

Entity Profile

Dependency Diagram

graph LR
  fbf5c9a0_ac68_1e92_c519_0b4bf0626929["test_list.py"]
  e2341fcc_05a2_c93d_0dbb_5136ca5d8e4d["utils.py"]
  fbf5c9a0_ac68_1e92_c519_0b4bf0626929 --> e2341fcc_05a2_c93d_0dbb_5136ca5d8e4d
  d1360ba2_24b5_be26_1bb8_d64ba3706aef["get_body_model_name"]
  fbf5c9a0_ac68_1e92_c519_0b4bf0626929 --> d1360ba2_24b5_be26_1bb8_d64ba3706aef
  0dda2280_3359_8460_301c_e98c77e78185["typing"]
  fbf5c9a0_ac68_1e92_c519_0b4bf0626929 --> 0dda2280_3359_8460_301c_e98c77e78185
  5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"]
  fbf5c9a0_ac68_1e92_c519_0b4bf0626929 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  fbf5c9a0_ac68_1e92_c519_0b4bf0626929 --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  fbf5c9a0_ac68_1e92_c519_0b4bf0626929 --> a7c04dee_ee23_5891_b185_47ff6bed036d
  style fbf5c9a0_ac68_1e92_c519_0b4bf0626929 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from typing import Annotated

import pytest
from fastapi import FastAPI, File, UploadFile
from fastapi.testclient import TestClient

from .utils import get_body_model_name

app = FastAPI()

# =====================================================================================
# Without aliases


@app.post("/list-bytes", operation_id="list_bytes")
async def read_list_bytes(p: Annotated[list[bytes], File()]):
    return {"file_size": [len(file) for file in p]}


@app.post("/list-uploadfile", operation_id="list_uploadfile")
async def read_list_uploadfile(p: Annotated[list[UploadFile], File()]):
    return {"file_size": [file.size for file in p]}


@pytest.mark.parametrize(
    "path",
    [
        "/list-bytes",
        "/list-uploadfile",
    ],
)
def test_list_schema(path: str):
    openapi = app.openapi()
    body_model_name = get_body_model_name(openapi, path)

    assert app.openapi()["components"]["schemas"][body_model_name] == {
        "properties": {
            "p": {
                "type": "array",
                "items": {"type": "string", "format": "binary"},
                "title": "P",
            },
        },
        "required": ["p"],
        "title": body_model_name,
        "type": "object",
    }


@pytest.mark.parametrize(
    "path",
    [
        "/list-bytes",
        "/list-uploadfile",
    ],
)
def test_list_missing(path: str):
    client = TestClient(app)
    response = client.post(path)
    assert response.status_code == 422
// ... (382 more lines)

Domain

Subdomains

Frequently Asked Questions

What does test_list.py do?
test_list.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Routing subdomain.
What functions are defined in test_list.py?
test_list.py defines 24 function(s): read_list_bytes, read_list_bytes_alias, read_list_bytes_alias_and_validation_alias, read_list_bytes_validation_alias, read_list_uploadfile, read_list_uploadfile_alias, read_list_uploadfile_alias_and_validation_alias, read_list_uploadfile_validation_alias, test_list, test_list_alias_and_validation_alias_by_alias, and 14 more.
What does test_list.py depend on?
test_list.py imports 6 module(s): __init__.py, get_body_model_name, pytest, testclient.py, typing, utils.py.
Where is test_list.py in the architecture?
test_list.py is located at tests/test_request_params/test_file/test_list.py (domain: FastAPI, subdomain: Routing, directory: tests/test_request_params/test_file).

Analyze Your Own Codebase

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

Try Supermodel Free