Home / File/ test_no_schema_split.py — fastapi Source File

test_no_schema_split.py — fastapi Source File

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

File python FastAPI Responses 5 imports 3 functions 4 classes

Entity Profile

Dependency Diagram

graph LR
  b56890d6_fe1a_8fde_5dcf_cb5f01eeefe6["test_no_schema_split.py"]
  712b7268_fde0_3ca8_dc06_7aa9a47c77d9["enum"]
  b56890d6_fe1a_8fde_5dcf_cb5f01eeefe6 --> 712b7268_fde0_3ca8_dc06_7aa9a47c77d9
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  b56890d6_fe1a_8fde_5dcf_cb5f01eeefe6 --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  b56890d6_fe1a_8fde_5dcf_cb5f01eeefe6 --> a7c04dee_ee23_5891_b185_47ff6bed036d
  a7f4e7b0_9725_db90_5cbc_7ca8211b323a["inline_snapshot"]
  b56890d6_fe1a_8fde_5dcf_cb5f01eeefe6 --> a7f4e7b0_9725_db90_5cbc_7ca8211b323a
  6913fbd4_39df_d14b_44bb_522e99b65b90["pydantic"]
  b56890d6_fe1a_8fde_5dcf_cb5f01eeefe6 --> 6913fbd4_39df_d14b_44bb_522e99b65b90
  style b56890d6_fe1a_8fde_5dcf_cb5f01eeefe6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

# Test with parts from, and to verify the report in:
# https://github.com/fastapi/fastapi/discussions/14177
# Made an issue in:
# https://github.com/fastapi/fastapi/issues/14247
from enum import Enum

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


class MessageEventType(str, Enum):
    alpha = "alpha"
    beta = "beta"


class MessageEvent(BaseModel):
    event_type: MessageEventType = Field(default=MessageEventType.alpha)
    output: str


class MessageOutput(BaseModel):
    body: str = ""
    events: list[MessageEvent] = []


class Message(BaseModel):
    input: str
    output: MessageOutput


app = FastAPI(title="Minimal FastAPI App", version="1.0.0")


@app.post("/messages", response_model=Message)
async def create_message(input_message: str) -> Message:
    return Message(
        input=input_message,
        output=MessageOutput(body=f"Processed: {input_message}"),
    )


client = TestClient(app)


def test_create_message():
    response = client.post("/messages", params={"input_message": "Hello"})
    assert response.status_code == 200, response.text
    assert response.json() == {
        "input": "Hello",
        "output": {"body": "Processed: Hello", "events": []},
    }


def test_openapi_schema():
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == snapshot(
        {
// ... (117 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does test_no_schema_split.py do?
test_no_schema_split.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_no_schema_split.py?
test_no_schema_split.py defines 3 function(s): create_message, test_create_message, test_openapi_schema.
What does test_no_schema_split.py depend on?
test_no_schema_split.py imports 5 module(s): __init__.py, enum, inline_snapshot, pydantic, testclient.py.
Where is test_no_schema_split.py in the architecture?
test_no_schema_split.py is located at tests/test_no_schema_split.py (domain: FastAPI, subdomain: Responses, directory: tests).

Analyze Your Own Codebase

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

Try Supermodel Free