mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-05-22 21:46:17 +03:00
Add the test
This commit is contained in:
parent
16fbb37694
commit
aa3317c7eb
|
@ -1,5 +1,6 @@
|
|||
"""Dependency injector base providers unit tests."""
|
||||
|
||||
from abc import ABC
|
||||
import unittest2 as unittest
|
||||
|
||||
from dependency_injector import (
|
||||
|
@ -249,6 +250,19 @@ class DependencyTests(unittest.TestCase):
|
|||
def test_init_with_not_class(self):
|
||||
self.assertRaises(TypeError, providers.Dependency, object())
|
||||
|
||||
def test_with_abc(self):
|
||||
class Base(ABC):
|
||||
pass
|
||||
|
||||
class Implementation(Base):
|
||||
pass
|
||||
|
||||
provider = providers.Dependency(Base)
|
||||
provider.provided_by(providers.Object(Implementation()))
|
||||
|
||||
self.assertIsInstance(provider(), Base)
|
||||
self.assertIsInstance(provider(), Implementation)
|
||||
|
||||
def test_is_provider(self):
|
||||
self.assertTrue(providers.is_provider(self.provider))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user