From aa3317c7eb78455a8c132e56700ddcb95d4cf00e Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Wed, 22 Jul 2020 11:47:07 -0400 Subject: [PATCH] Add the test --- tests/unit/providers/test_base_py2_py3.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/unit/providers/test_base_py2_py3.py b/tests/unit/providers/test_base_py2_py3.py index 536de2b2..aed2d193 100644 --- a/tests/unit/providers/test_base_py2_py3.py +++ b/tests/unit/providers/test_base_py2_py3.py @@ -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))