Home / File/ test_depends_hashable.py — fastapi Source File

test_depends_hashable.py — fastapi Source File

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

File python FastAPI Applications 1 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  f56f6e9b_811a_350c_bbf5_311bb9d4c13b["test_depends_hashable.py"]
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  f56f6e9b_811a_350c_bbf5_311bb9d4c13b --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  style f56f6e9b_811a_350c_bbf5_311bb9d4c13b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

# This is more or less a workaround to make Depends and Security hashable
# as other tools that use them depend on that
# Ref: https://github.com/fastapi/fastapi/pull/14320

from fastapi import Depends, Security


def dep():
    pass


def test_depends_hashable():
    dep()  # just for coverage
    d1 = Depends(dep)
    d2 = Depends(dep)
    d3 = Depends(dep, scope="function")
    d4 = Depends(dep, scope="function")

    s1 = Security(dep)
    s2 = Security(dep)

    assert hash(d1) == hash(d2)
    assert hash(s1) == hash(s2)
    assert hash(d1) != hash(d3)
    assert hash(d3) == hash(d4)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does test_depends_hashable.py do?
test_depends_hashable.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_depends_hashable.py?
test_depends_hashable.py defines 2 function(s): dep, test_depends_hashable.
What does test_depends_hashable.py depend on?
test_depends_hashable.py imports 1 module(s): __init__.py.
Where is test_depends_hashable.py in the architecture?
test_depends_hashable.py is located at tests/test_depends_hashable.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