python-injector / python-injector/injector

Child injectors should respect parent injector's multibinds

Open
#297 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.5k
Forks
94
PR merge metrics
No merged PRs in 30d

Description

Example of a failing test case

def test_multibinds_are_extended_by_child_injectors():
    parent_injector = Injector()

    parent_injector.binder.multibind(List[str], to=['parent name'])

    child_injector = parent_injector.create_child_injector()

    child_injector.binder.multibind(List[str], to=['child name'])

    assert parent_injector.get(List[str]) == ['parent name']
    assert child_injector.get(List[str]) == ['parent name', 'child name']  # Currently: ['child name']

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the failing test test_multibinds_are_extended_by_child_injectors and trace Injector.create_child_injector(), binder.multibind(), and get(). Verify the parent injector remains unchanged while the child result contains both the parent and child bindings; the test should pass with the combined list.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.