Home / File/ test_response_model_sub_types.py — fastapi Source File

test_response_model_sub_types.py — fastapi Source File

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

File python FastAPI Applications 4 imports 6 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  107fefd2_4dff_5180_81e2_480b572b2f96["test_response_model_sub_types.py"]
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  107fefd2_4dff_5180_81e2_480b572b2f96 --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  107fefd2_4dff_5180_81e2_480b572b2f96 --> a7c04dee_ee23_5891_b185_47ff6bed036d
  a7f4e7b0_9725_db90_5cbc_7ca8211b323a["inline_snapshot"]
  107fefd2_4dff_5180_81e2_480b572b2f96 --> a7f4e7b0_9725_db90_5cbc_7ca8211b323a
  6913fbd4_39df_d14b_44bb_522e99b65b90["pydantic"]
  107fefd2_4dff_5180_81e2_480b572b2f96 --> 6913fbd4_39df_d14b_44bb_522e99b65b90
  style 107fefd2_4dff_5180_81e2_480b572b2f96 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from fastapi import FastAPI
from fastapi.testclient import TestClient
from inline_snapshot import snapshot
from pydantic import BaseModel


class Model(BaseModel):
    name: str


app = FastAPI()


@app.get("/valid1", responses={"500": {"model": int}})
def valid1():
    pass


@app.get("/valid2", responses={"500": {"model": list[int]}})
def valid2():
    pass


@app.get("/valid3", responses={"500": {"model": Model}})
def valid3():
    pass


@app.get("/valid4", responses={"500": {"model": list[Model]}})
def valid4():
    pass


client = TestClient(app)


def test_path_operations():
    response = client.get("/valid1")
    assert response.status_code == 200, response.text
    response = client.get("/valid2")
    assert response.status_code == 200, response.text
    response = client.get("/valid3")
    assert response.status_code == 200, response.text
    response = client.get("/valid4")
    assert response.status_code == 200, response.text


def test_openapi_schema():
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == snapshot(
        {
            "openapi": "3.1.0",
            "info": {"title": "FastAPI", "version": "0.1.0"},
            "paths": {
                "/valid1": {
                    "get": {
                        "summary": "Valid1",
                        "operationId": "valid1_valid1_get",
                        "responses": {
// ... (102 more lines)

Domain

Subdomains

Classes

Dependencies

Frequently Asked Questions

What does test_response_model_sub_types.py do?
test_response_model_sub_types.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_response_model_sub_types.py?
test_response_model_sub_types.py defines 6 function(s): test_openapi_schema, test_path_operations, valid1, valid2, valid3, valid4.
What does test_response_model_sub_types.py depend on?
test_response_model_sub_types.py imports 4 module(s): __init__.py, inline_snapshot, pydantic, testclient.py.
Where is test_response_model_sub_types.py in the architecture?
test_response_model_sub_types.py is located at tests/test_response_model_sub_types.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