@@ 150-163 (lines=14) @@ | ||
147 | assert another_example_function.__doc__.strip() == "I am DOCS" # type: ignore[union-attr] |
|
148 | ||
149 | ||
150 | def test_partials_can_be_provided_with_an_update_method(container: Container): |
|
151 | def _my_func(a, b: MyDep = injectable): |
|
152 | return a, b |
|
153 | ||
154 | def _dep_two_is_dep_one(c: WriteableContainer, a, k): |
|
155 | # We'll do something a bit weird and say the container |
|
156 | # always injects the first supplied argument when asked for |
|
157 | # a MyDep. Don't do this for real. |
|
158 | c[MyDep] = a[0] |
|
159 | ||
160 | weird = container.partial(_my_func, container_updater=_dep_two_is_dep_one) |
|
161 | ||
162 | arg_1, arg_2 = weird("hello") |
|
163 | assert arg_1 == arg_2 |
|
164 |
@@ 145-158 (lines=14) @@ | ||
142 | assert another_example_function.__doc__.strip() == "I am DOCS" # type: ignore[union-attr] |
|
143 | ||
144 | ||
145 | def test_partials_can_be_provided_with_an_update_method(container: Container): |
|
146 | def _my_func(a, b: MyDep): |
|
147 | return a, b |
|
148 | ||
149 | def _dep_two_is_dep_one(c: WriteableContainer, a, k): |
|
150 | # We'll do something a bit weird and say the container |
|
151 | # always injects the first supplied argument when asked for |
|
152 | # a MyDep. Don't do this for real. |
|
153 | c[MyDep] = a[0] |
|
154 | ||
155 | weird = container.magic_partial(_my_func, container_updater=_dep_two_is_dep_one) |
|
156 | ||
157 | arg_1, arg_2 = weird("hello") |
|
158 | assert arg_1 == arg_2 |
|
159 |