python-dependency-injector/tests/typing/dynamic_container.py
Roman Mogylatov 2e940adb50
Typing stubs (#286)
* Add basic setup

* Add more tests for factory

* Add mypy checks to CI

* Add mypy checks to makefile command

* Add typing for the factories

* Add stub for Callable providers

* Add typing module and object provider stubs

* Fix typing test issue

* Remove typing module

* Add Delegate stub

* Add stub for Dependency provider

* Add stub for ExternalDependency

* Add stubs for providers module functions

* Add stubs for the DependenciesContainer provider

* Add stub for the CallableDelegate provider

* Add stubs for Coroutine providers

* Add stubs for the configuration options

* Add stub for the FactoryDelegate

* Add stub for the FactoryAggregate provider

* Add singleton stubs

* Add stubs for singletons

* Add stub for the List provider

* Add stub for the Container provider

* Add stub for the Selector provider

* Add stubs for the dynamic container

* Add stub for the declarative container

* Add stubs for the extensions

* Add types module for explicit provider typing

* Set absolute import mode for the providers module and add types module test

* Skip typing test for Python 3.5

* Remove coroutine test from py35

* Fix py35 tests

* Add \n to the tox.ini
2020-08-26 22:24:20 -04:00

19 lines
555 B
Python

from dependency_injector import containers, providers
# Test 1: to check setattr
container1 = containers.DynamicContainer()
container1.abc = providers.Provider()
# Test 2: to check override()
container2 = containers.DynamicContainer()
container2.override(containers.DynamicContainer())
# Test 3: to check override_providers()
container3 = containers.DynamicContainer()
container3.override_providers(a=providers.Provider())
# Test 4: to check set_providers()
container4 = containers.DynamicContainer()
container4.set_providers(a=providers.Provider())