We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d6e0ea4 commit 1d58fd7Copy full SHA for 1d58fd7
injector_test.py
@@ -1761,6 +1761,15 @@ def function(a: Inject[Inject[int]]) -> None:
1761
assert get_bindings(function) == {'a': int}
1762
1763
1764
+ # This will not inject `None` even if there is a provider configured to provide
1765
+ # str | None elsewhere in the graph because `None` is stripped in
1766
+ @inject
1767
+ def function12(a: str | None):
1768
+ pass
1769
+
1770
+ assert get_bindings(function12) == {'a': str | None}
1771
1772
1773
# Tests https://github.com/alecthomas/injector/issues/202
1774
@pytest.mark.skipif(sys.version_info < (3, 10), reason="Requires Python 3.10+")
1775
def test_get_bindings_for_pep_604():
0 commit comments