Home / File/ test_dependency_class.py — fastapi Source File

test_dependency_class.py — fastapi Source File

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

File python FastAPI Responses 4 imports 13 functions 5 classes

Entity Profile

Dependency Diagram

graph LR
  b7174901_25d4_b50d_6a32_1bb74e431df2["test_dependency_class.py"]
  07d79a2e_d4e9_0bbb_be90_936274444c8c["collections.abc"]
  b7174901_25d4_b50d_6a32_1bb74e431df2 --> 07d79a2e_d4e9_0bbb_be90_936274444c8c
  5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"]
  b7174901_25d4_b50d_6a32_1bb74e431df2 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  b7174901_25d4_b50d_6a32_1bb74e431df2 --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  b7174901_25d4_b50d_6a32_1bb74e431df2 --> a7c04dee_ee23_5891_b185_47ff6bed036d
  style b7174901_25d4_b50d_6a32_1bb74e431df2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from collections.abc import AsyncGenerator, Generator

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

app = FastAPI()


class CallableDependency:
    def __call__(self, value: str) -> str:
        return value


class CallableGenDependency:
    def __call__(self, value: str) -> Generator[str, None, None]:
        yield value


class AsyncCallableDependency:
    async def __call__(self, value: str) -> str:
        return value


class AsyncCallableGenDependency:
    async def __call__(self, value: str) -> AsyncGenerator[str, None]:
        yield value


class MethodsDependency:
    def synchronous(self, value: str) -> str:
        return value

    async def asynchronous(self, value: str) -> str:
        return value

    def synchronous_gen(self, value: str) -> Generator[str, None, None]:
        yield value

    async def asynchronous_gen(self, value: str) -> AsyncGenerator[str, None]:
        yield value


callable_dependency = CallableDependency()
callable_gen_dependency = CallableGenDependency()
async_callable_dependency = AsyncCallableDependency()
async_callable_gen_dependency = AsyncCallableGenDependency()
methods_dependency = MethodsDependency()


@app.get("/callable-dependency-class")
async def get_callable_dependency_class(
    value: str, instance: CallableDependency = Depends()
):
    return instance(value)


@app.get("/callable-gen-dependency-class")
async def get_callable_gen_dependency_class(
    value: str, instance: CallableGenDependency = Depends()
// ... (95 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does test_dependency_class.py do?
test_dependency_class.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_dependency_class.py?
test_dependency_class.py defines 13 function(s): get_async_callable_dependency, get_async_callable_dependency_class, get_async_callable_gen_dependency, get_async_callable_gen_dependency_class, get_asynchronous_method_dependency, get_asynchronous_method_gen_dependency, get_callable_dependency, get_callable_dependency_class, get_callable_gen_dependency, get_callable_gen_dependency_class, and 3 more.
What does test_dependency_class.py depend on?
test_dependency_class.py imports 4 module(s): __init__.py, collections.abc, pytest, testclient.py.
Where is test_dependency_class.py in the architecture?
test_dependency_class.py is located at tests/test_dependency_class.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