Home / File/ test_get_model_definitions_formfeed_escape.py — fastapi Source File

test_get_model_definitions_formfeed_escape.py — fastapi Source File

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

File python FastAPI Responses 5 imports 3 functions 2 classes

Entity Profile

Dependency Diagram

graph LR
  f5d6c39f_edf3_f284_1d2b_a21f1c182903["test_get_model_definitions_formfeed_escape.py"]
  5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"]
  f5d6c39f_edf3_f284_1d2b_a21f1c182903 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  f5d6c39f_edf3_f284_1d2b_a21f1c182903 --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  f5d6c39f_edf3_f284_1d2b_a21f1c182903 --> a7c04dee_ee23_5891_b185_47ff6bed036d
  a7f4e7b0_9725_db90_5cbc_7ca8211b323a["inline_snapshot"]
  f5d6c39f_edf3_f284_1d2b_a21f1c182903 --> a7f4e7b0_9725_db90_5cbc_7ca8211b323a
  6913fbd4_39df_d14b_44bb_522e99b65b90["pydantic"]
  f5d6c39f_edf3_f284_1d2b_a21f1c182903 --> 6913fbd4_39df_d14b_44bb_522e99b65b90
  style f5d6c39f_edf3_f284_1d2b_a21f1c182903 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import pytest
from fastapi import FastAPI
from fastapi.testclient import TestClient
from inline_snapshot import snapshot


@pytest.fixture(name="client")
def client_fixture() -> TestClient:
    from pydantic import BaseModel

    class Address(BaseModel):
        """
        This is a public description of an Address
        \f
        You can't see this part of the docstring, it's private!
        """

        line_1: str
        city: str
        state_province: str

    class Facility(BaseModel):
        id: str
        address: Address

    app = FastAPI()

    @app.get("/facilities/{facility_id}")
    def get_facility(facility_id: str) -> Facility:
        return Facility(
            id=facility_id,
            address=Address(line_1="123 Main St", city="Anytown", state_province="CA"),
        )

    client = TestClient(app)
    return client


def test_get(client: TestClient):
    response = client.get("/facilities/42")
    assert response.status_code == 200, response.text
    assert response.json() == {
        "id": "42",
        "address": {
            "line_1": "123 Main St",
            "city": "Anytown",
            "state_province": "CA",
        },
    }


def test_openapi_schema(client: TestClient):
    """
    Sanity check to ensure our app's openapi schema renders as we expect
    """
    response = client.get("/openapi.json")
    assert response.status_code == 200, response.text
    assert response.json() == snapshot(
        {
            "components": {
// ... (101 more lines)

Domain

Subdomains

Classes

Dependencies

Frequently Asked Questions

What does test_get_model_definitions_formfeed_escape.py do?
test_get_model_definitions_formfeed_escape.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_get_model_definitions_formfeed_escape.py?
test_get_model_definitions_formfeed_escape.py defines 3 function(s): client_fixture, test_get, test_openapi_schema.
What does test_get_model_definitions_formfeed_escape.py depend on?
test_get_model_definitions_formfeed_escape.py imports 5 module(s): __init__.py, inline_snapshot, pydantic, pytest, testclient.py.
Where is test_get_model_definitions_formfeed_escape.py in the architecture?
test_get_model_definitions_formfeed_escape.py is located at tests/test_get_model_definitions_formfeed_escape.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