mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-24 18:43:58 +03:00
b4df3dd2c9
* Fix type annotations for .provides * Fix type hinting for .provides as @rmk135 suggested
18 lines
616 B
Python
18 lines
616 B
Python
from typing import Optional
|
|
|
|
from dependency_injector import providers
|
|
|
|
# Test 1: to check the return type
|
|
provider1 = providers.Delegate(providers.Provider())
|
|
var1: providers.Provider = provider1()
|
|
|
|
# Test 2: to check the return type with await
|
|
provider2 = providers.Delegate(providers.Provider())
|
|
async def _async2() -> None:
|
|
var1: providers.Provider = await provider2() # type: ignore
|
|
var2: providers.Provider = await provider2.async_()
|
|
|
|
# Test 3: to check class type from provider
|
|
provider3 = providers.Delegate(providers.Provider())
|
|
provided_provides: Optional[providers.Provider] = provider3.provides
|