Home / File/ test_param_class.py — fastapi Source File

test_param_class.py — fastapi Source File

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

File python FastAPI Routing 5 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  46ab9a31_30f6_6d74_8ef3_620603cce435["test_param_class.py"]
  0dda2280_3359_8460_301c_e98c77e78185["typing"]
  46ab9a31_30f6_6d74_8ef3_620603cce435 --> 0dda2280_3359_8460_301c_e98c77e78185
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  46ab9a31_30f6_6d74_8ef3_620603cce435 --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  2bb4dd2d_8b8a_6502_751c_38eabb6ae71e["params.py"]
  46ab9a31_30f6_6d74_8ef3_620603cce435 --> 2bb4dd2d_8b8a_6502_751c_38eabb6ae71e
  a15334a5_304f_0e4c_dce0_12ffde49a6b7["Param"]
  46ab9a31_30f6_6d74_8ef3_620603cce435 --> a15334a5_304f_0e4c_dce0_12ffde49a6b7
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  46ab9a31_30f6_6d74_8ef3_620603cce435 --> a7c04dee_ee23_5891_b185_47ff6bed036d
  style 46ab9a31_30f6_6d74_8ef3_620603cce435 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from typing import Optional

from fastapi import FastAPI
from fastapi.params import Param
from fastapi.testclient import TestClient

app = FastAPI()


@app.get("/items/")
def read_items(q: Optional[str] = Param(default=None)):  # type: ignore
    return {"q": q}


client = TestClient(app)


def test_default_param_query_none():
    response = client.get("/items/")
    assert response.status_code == 200, response.text
    assert response.json() == {"q": None}


def test_default_param_query():
    response = client.get("/items/?q=foo")
    assert response.status_code == 200, response.text
    assert response.json() == {"q": "foo"}

Domain

Subdomains

Frequently Asked Questions

What does test_param_class.py do?
test_param_class.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Routing subdomain.
What functions are defined in test_param_class.py?
test_param_class.py defines 3 function(s): read_items, test_default_param_query, test_default_param_query_none.
What does test_param_class.py depend on?
test_param_class.py imports 5 module(s): Param, __init__.py, params.py, testclient.py, typing.
Where is test_param_class.py in the architecture?
test_param_class.py is located at tests/test_param_class.py (domain: FastAPI, subdomain: Routing, directory: tests).

Analyze Your Own Codebase

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

Try Supermodel Free