2021-08-24 04:24:36 +03:00
|
|
|
from typing import Optional
|
2020-08-27 05:24:20 +03:00
|
|
|
|
2021-08-24 04:24:36 +03:00
|
|
|
from dependency_injector import providers
|
2020-08-27 05:24:20 +03:00
|
|
|
|
|
|
|
# Test 1: to check the return type
|
|
|
|
provider1 = providers.Delegate(providers.Provider())
|
|
|
|
var1: providers.Provider = provider1()
|
2021-01-11 03:26:15 +03:00
|
|
|
|
|
|
|
# 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_()
|
2021-08-24 04:24:36 +03:00
|
|
|
|
|
|
|
# Test 3: to check class type from provider
|
|
|
|
provider3 = providers.Delegate(providers.Provider())
|
|
|
|
provided_provides: Optional[providers.Provider] = provider3.provides
|