Home / File/ test_repeated_parameter_alias.py — fastapi Source File

test_repeated_parameter_alias.py — fastapi Source File

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

File python FastAPI Applications 3 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  23de5266_6d76_5349_62c3_4c0e8a118b67["test_repeated_parameter_alias.py"]
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  23de5266_6d76_5349_62c3_4c0e8a118b67 --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  23de5266_6d76_5349_62c3_4c0e8a118b67 --> a7c04dee_ee23_5891_b185_47ff6bed036d
  a7f4e7b0_9725_db90_5cbc_7ca8211b323a["inline_snapshot"]
  23de5266_6d76_5349_62c3_4c0e8a118b67 --> a7f4e7b0_9725_db90_5cbc_7ca8211b323a
  style 23de5266_6d76_5349_62c3_4c0e8a118b67 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from fastapi import FastAPI, Path, Query, status
from fastapi.testclient import TestClient
from inline_snapshot import snapshot

app = FastAPI()


@app.get("/{repeated_alias}")
def get_parameters_with_repeated_aliases(
    path: str = Path(..., alias="repeated_alias"),
    query: str = Query(..., alias="repeated_alias"),
):
    return {"path": path, "query": query}


client = TestClient(app)


def test_get_parameters():
    response = client.get("/test_path", params={"repeated_alias": "test_query"})
    assert response.status_code == 200, response.text
    assert response.json() == {"path": "test_path", "query": "test_query"}


def test_openapi_schema():
    response = client.get("/openapi.json")
    assert response.status_code == status.HTTP_200_OK
    assert response.json() == snapshot(
        {
            "components": {
                "schemas": {
                    "HTTPValidationError": {
                        "properties": {
                            "detail": {
                                "items": {
                                    "$ref": "#/components/schemas/ValidationError"
                                },
                                "title": "Detail",
                                "type": "array",
                            }
                        },
                        "title": "HTTPValidationError",
                        "type": "object",
                    },
                    "ValidationError": {
                        "properties": {
                            "ctx": {"title": "Context", "type": "object"},
                            "input": {"title": "Input"},
                            "loc": {
                                "items": {
                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
                                },
                                "title": "Location",
                                "type": "array",
                            },
                            "msg": {"title": "Message", "type": "string"},
                            "type": {"title": "Error Type", "type": "string"},
                        },
                        "required": ["loc", "msg", "type"],
                        "title": "ValidationError",
                        "type": "object",
                    },
                }
            },
            "info": {"title": "FastAPI", "version": "0.1.0"},
            "openapi": "3.1.0",
            "paths": {
                "/{repeated_alias}": {
                    "get": {
                        "operationId": "get_parameters_with_repeated_aliases__repeated_alias__get",
                        "parameters": [
                            {
                                "in": "path",
                                "name": "repeated_alias",
                                "required": True,
                                "schema": {"title": "Repeated Alias", "type": "string"},
                            },
                            {
                                "in": "query",
                                "name": "repeated_alias",
                                "required": True,
                                "schema": {"title": "Repeated Alias", "type": "string"},
                            },
                        ],
                        "responses": {
                            "200": {
                                "content": {"application/json": {"schema": {}}},
                                "description": "Successful Response",
                            },
                            "422": {
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/HTTPValidationError"
                                        }
                                    }
                                },
                                "description": "Validation Error",
                            },
                        },
                        "summary": "Get Parameters With Repeated Aliases",
                    }
                }
            },
        }
    )

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does test_repeated_parameter_alias.py do?
test_repeated_parameter_alias.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_repeated_parameter_alias.py?
test_repeated_parameter_alias.py defines 3 function(s): get_parameters_with_repeated_aliases, test_get_parameters, test_openapi_schema.
What does test_repeated_parameter_alias.py depend on?
test_repeated_parameter_alias.py imports 3 module(s): __init__.py, inline_snapshot, testclient.py.
Where is test_repeated_parameter_alias.py in the architecture?
test_repeated_parameter_alias.py is located at tests/test_repeated_parameter_alias.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