# registering two factories, one without context and another with a context
registry.register_factory(factory_a, DummyFactory)
registry.register_factory(factory_b, DummyFactory, context=ContextB)
Scenario 1, works fine:
# getting factories from a container, all as expected
assert container.get(DummyFactory, context=context_b) is factory_b.result
assert container.get(DummyFactory) is factory_a.result
Scenario 2, returns factory_a instead of factory_b:
# seccond assertion fails because of `factory_a` is returned
assert container.get(DummyFactory) is factory_a.result
assert container.get(DummyFactory, context=context_b) is factory_b.result
Seems like a bug to me.
Set up code
Scenario 1, works fine:
Scenario 2, returns
factory_a
instead offactory_b
:Tests for this issue can be found in PR https://github.com/mmerickel/wired/pull/11.