Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
maldoinc committed Aug 11, 2024
1 parent 8c4b44d commit bd41360
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/unit/test_module_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from test.unit.services.with_annotations.env import EnvService
from test.unit.services.with_annotations.services import IFoo

import wireup
from wireup import DependencyContainer, ParameterBag, initialize_container, register_all_in_module, warmup_container


Expand Down Expand Up @@ -38,3 +39,13 @@ def test_loads_module_is_file(self):
self.assertEqual("foo", container.get(services.IFoo).get_foo())
self.assertEqual(4, container.get(RandomService, qualifier="foo").get_random())
self.assertEqual(5, container.get(TrulyRandomService, qualifier="foo").get_truly_random())

def test_initialize_is_idempotent_recreates_container(self):
id_start = id(wireup.container)
initialize_container(service_modules=[services])
id1 = id(wireup.container)
initialize_container(service_modules=[services])
id2 = id(wireup.container)

self.assertNotEqual(id_start, id1)
self.assertNotEqual(id1, id2)

0 comments on commit bd41360

Please sign in to comment.