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

Autowired(List[...]) does not work with qualifiers #8

Closed
roo-oliv opened this issue Apr 15, 2020 · 0 comments · Fixed by #9
Closed

Autowired(List[...]) does not work with qualifiers #8

roo-oliv opened this issue Apr 15, 2020 · 0 comments · Fixed by #9
Assignees
Labels
bug Something isn't working fix released A fix for this issue was released to PyPI

Comments

@roo-oliv
Copy link
Owner

roo-oliv commented Apr 15, 2020

This script reproduces the bug:

from typing import List
from injectable import injectable, autowired, Autowired, InjectionContainer

@injectable(qualifier="foo")
class Foo:
    pass

@autowired
def test(foo: Autowired(List["foo"])):
    assert foo is not None
    assert len(foo) == 1

if __name__ == "__main__":
    InjectionContainer.load()
    test()

The returned error is quite cryptic:

AttributeError: '_ForwardRef' object has no attribute '__qualname__'

@roo-oliv roo-oliv added the bug Something isn't working label Apr 15, 2020
@roo-oliv roo-oliv self-assigned this Apr 15, 2020
@roo-oliv roo-oliv added the fix released A fix for this issue was released to PyPI label May 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fix released A fix for this issue was released to PyPI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant