python-dependency-injector/tests/typing/container.py
Leonardus Chen 635c755d74 Retrofit assert type for:
- configuration.py
- container.py
- declarative_container.py
- delegate.py
- dependencies_container.py
- dependency.py
- dict.py
- dynamic_container.py
2025-12-08 14:00:30 +07:00

20 lines
400 B
Python

from typing import Any
from typing_extensions import assert_type
from dependency_injector import providers
class Container: ...
# Test 1: to check the return type
provider1 = providers.Container(Container)
var1 = provider1()
assert_type(var1, Container)
# Test 2: to check the getattr
provider2 = providers.Container(Container)
attr = provider2.attr
assert_type(attr, providers.Provider[Any])