mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-25 11:04:01 +03:00
Fix resource subclass abc tests on Python 3.7
This commit is contained in:
parent
1163ac59d4
commit
83c2af0e7e
|
@ -165,10 +165,9 @@ class ResourceTests(unittest.TestCase):
|
||||||
with self.assertRaises(TypeError) as context:
|
with self.assertRaises(TypeError) as context:
|
||||||
TestResource()
|
TestResource()
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertIn("Can't instantiate abstract class TestResource", str(context.exception))
|
||||||
"Can't instantiate abstract class TestResource with abstract methods init, shutdown",
|
self.assertIn("init, shutdown", str(context.exception))
|
||||||
str(context.exception),
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_init_class_abc_shutdown_definition_is_required(self):
|
def test_init_class_abc_shutdown_definition_is_required(self):
|
||||||
class TestResource(resources.Resource):
|
class TestResource(resources.Resource):
|
||||||
|
@ -178,10 +177,8 @@ class ResourceTests(unittest.TestCase):
|
||||||
with self.assertRaises(TypeError) as context:
|
with self.assertRaises(TypeError) as context:
|
||||||
TestResource()
|
TestResource()
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertIn("Can't instantiate abstract class TestResource", str(context.exception))
|
||||||
"Can't instantiate abstract class TestResource with abstract method shutdown",
|
self.assertIn("shutdown", str(context.exception))
|
||||||
str(context.exception),
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_init_not_callable(self):
|
def test_init_not_callable(self):
|
||||||
provider = providers.Resource(1)
|
provider = providers.Resource(1)
|
||||||
|
@ -507,10 +504,8 @@ class AsyncResourceTest(AsyncTestCase):
|
||||||
with self.assertRaises(TypeError) as context:
|
with self.assertRaises(TypeError) as context:
|
||||||
TestAsyncResource()
|
TestAsyncResource()
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertIn("Can't instantiate abstract class TestAsyncResource", str(context.exception))
|
||||||
"Can't instantiate abstract class TestAsyncResource with abstract methods init, shutdown",
|
self.assertIn("init, shutdown", str(context.exception))
|
||||||
str(context.exception),
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_init_async_class_abc_shutdown_definition_is_required(self):
|
def test_init_async_class_abc_shutdown_definition_is_required(self):
|
||||||
class TestAsyncResource(resources.AsyncResource):
|
class TestAsyncResource(resources.AsyncResource):
|
||||||
|
@ -520,10 +515,8 @@ class AsyncResourceTest(AsyncTestCase):
|
||||||
with self.assertRaises(TypeError) as context:
|
with self.assertRaises(TypeError) as context:
|
||||||
TestAsyncResource()
|
TestAsyncResource()
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertIn("Can't instantiate abstract class TestAsyncResource", str(context.exception))
|
||||||
"Can't instantiate abstract class TestAsyncResource with abstract method shutdown",
|
self.assertIn("shutdown", str(context.exception))
|
||||||
str(context.exception),
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_init_with_error(self):
|
def test_init_with_error(self):
|
||||||
async def _init():
|
async def _init():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user