Skip to content

Commit 55f01cc

Browse files
committed
Add test.
1 parent ed5d972 commit 55f01cc

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/unit_test/container/resolve/test_resolve_with_injection.py

+19
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,22 @@ def __init__(self, white_colors: List[AllTagged[Red, Green, Blue]]):
188188
self.assertEqual(len(resolved_dependency.white_colors), 1)
189189
self.assertIsInstance(resolved_dependency.white_colors[0], White)
190190
self.assertNotIsInstance(resolved_dependency.white_colors[0], NonWhite)
191+
192+
def test_resolve_injects_empty_list_if_no_tags_match(self):
193+
# arrange
194+
class PrimaryPort:
195+
pass
196+
197+
class Application:
198+
def __init__(self, primary_ports: List[Tagged[PrimaryPort]]):
199+
self.primary_ports = primary_ports
200+
201+
dependency_container = DependencyContainer.get_instance()
202+
dependency_container.register_transient(Application)
203+
204+
# act
205+
resolved_dependency = dependency_container.resolve(Application)
206+
207+
# assert
208+
self.assertIsInstance(resolved_dependency, Application)
209+
self.assertEqual(len(resolved_dependency.primary_ports), 0)

0 commit comments

Comments
 (0)