Home / File/ test_additional_responses_bad.py — fastapi Source File

test_additional_responses_bad.py — fastapi Source File

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

File python FastAPI Responses 3 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  ae4a5c9b_b18b_3b87_1e5e_7136db518ac0["test_additional_responses_bad.py"]
  5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"]
  ae4a5c9b_b18b_3b87_1e5e_7136db518ac0 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  ae4a5c9b_b18b_3b87_1e5e_7136db518ac0 --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  ae4a5c9b_b18b_3b87_1e5e_7136db518ac0 --> a7c04dee_ee23_5891_b185_47ff6bed036d
  style ae4a5c9b_b18b_3b87_1e5e_7136db518ac0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

app = FastAPI()


@app.get("/a", responses={"hello": {"description": "Not a valid additional response"}})
async def a():
    pass  # pragma: no cover


openapi_schema = {
    "openapi": "3.1.0",
    "info": {"title": "FastAPI", "version": "0.1.0"},
    "paths": {
        "/a": {
            "get": {
                "responses": {
                    # this is how one would imagine the openapi schema to be
                    # but since the key is not valid, openapi.utils.get_openapi will raise ValueError
                    "hello": {"description": "Not a valid additional response"},
                    "200": {
                        "description": "Successful Response",
                        "content": {"application/json": {"schema": {}}},
                    },
                },
                "summary": "A",
                "operationId": "a_a_get",
            }
        }
    },
}

client = TestClient(app)


def test_openapi_schema():
    with pytest.raises(ValueError):
        client.get("/openapi.json")

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does test_additional_responses_bad.py do?
test_additional_responses_bad.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_additional_responses_bad.py?
test_additional_responses_bad.py defines 2 function(s): a, test_openapi_schema.
What does test_additional_responses_bad.py depend on?
test_additional_responses_bad.py imports 3 module(s): __init__.py, pytest, testclient.py.
Where is test_additional_responses_bad.py in the architecture?
test_additional_responses_bad.py is located at tests/test_additional_responses_bad.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