Skip to content

Commit

Permalink
Added some tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
s3rius committed Sep 29, 2024
1 parent a5c2948 commit 5618873
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,15 @@ def dep(info: ParamInfo = Depends()) -> ParamInfo:
def target(my_test_param: ParamInfo = Depends(dep)) -> None:
return None

with DependencyGraph(target=target).sync_ctx() as g:
graph = DependencyGraph(target=target)
with graph.sync_ctx() as g:
kwargs = g.resolve_kwargs()

info: ParamInfo = kwargs["my_test_param"]
assert info.name == "my_test_param"
assert info.definition
assert info.definition.annotation == ParamInfo
assert info.graph == graph


def test_param_info_no_dependant() -> None:
Expand All @@ -349,12 +351,14 @@ def test_param_info_no_dependant() -> None:
def target(info: ParamInfo = Depends()) -> None:
return None

with DependencyGraph(target=target).sync_ctx() as g:
graph = DependencyGraph(target=target)
with graph.sync_ctx() as g:
kwargs = g.resolve_kwargs()

info: ParamInfo = kwargs["info"]
assert info.name == ""
assert info.definition is None
assert info.graph == graph


def test_class_based_dependencies() -> None:
Expand Down

0 comments on commit 5618873

Please sign in to comment.