Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support batch override #3

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

nrbnlulu
Copy link
Contributor

def test_override_batch() -> None:
    container = Container()
    container.register(Object(0))
    container.register(Object("barfoo"))

    with container.override_batch(
        Object(1),
        Object("foobar"),
    ), container.sync_context() as ctx:
        assert ctx.resolve(int) == 1
        assert ctx.resolve(str) == "foobar"

    with container.sync_context() as ctx:
        assert ctx.resolve(int) == 0
        assert ctx.resolve(str) == "barfoo"

@ThirVondukr ThirVondukr merged commit dcbd723 into ThirVondukr:main Feb 28, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants