Skip to content

Commit 5618873

Browse files
committed
Added some tests.
1 parent a5c2948 commit 5618873

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tests/test_graph.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,13 +334,15 @@ def dep(info: ParamInfo = Depends()) -> ParamInfo:
334334
def target(my_test_param: ParamInfo = Depends(dep)) -> None:
335335
return None
336336

337-
with DependencyGraph(target=target).sync_ctx() as g:
337+
graph = DependencyGraph(target=target)
338+
with graph.sync_ctx() as g:
338339
kwargs = g.resolve_kwargs()
339340

340341
info: ParamInfo = kwargs["my_test_param"]
341342
assert info.name == "my_test_param"
342343
assert info.definition
343344
assert info.definition.annotation == ParamInfo
345+
assert info.graph == graph
344346

345347

346348
def test_param_info_no_dependant() -> None:
@@ -349,12 +351,14 @@ def test_param_info_no_dependant() -> None:
349351
def target(info: ParamInfo = Depends()) -> None:
350352
return None
351353

352-
with DependencyGraph(target=target).sync_ctx() as g:
354+
graph = DependencyGraph(target=target)
355+
with graph.sync_ctx() as g:
353356
kwargs = g.resolve_kwargs()
354357

355358
info: ParamInfo = kwargs["info"]
356359
assert info.name == ""
357360
assert info.definition is None
361+
assert info.graph == graph
358362

359363

360364
def test_class_based_dependencies() -> None:

0 commit comments

Comments
 (0)