Skip to content

Commit

Permalink
Add test for overriding
Browse files Browse the repository at this point in the history
  • Loading branch information
yakimka committed Apr 21, 2024
1 parent 9b38357 commit e529cef
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_sync_di.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ def my_service(redis: Redis = Depends(get_redis)):
assert isinstance(redis, Redis)


def test_can_pass_dependency():
@inject
def my_service(redis: Redis | str = Depends(get_redis)):
return redis

redis = my_service(redis="override")

assert redis == "override"


def test_dependencies_in_single_call_must_use_cache():
@inject
def my_service(
Expand Down

0 comments on commit e529cef

Please sign in to comment.