Skip to content

Commit 83c2af0

Browse files
committed
Fix resource subclass abc tests on Python 3.7
1 parent 1163ac5 commit 83c2af0

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

tests/unit/providers/test_resource_py35.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,9 @@ class TestResource(resources.Resource):
165165
with self.assertRaises(TypeError) as context:
166166
TestResource()
167167

168-
self.assertEqual(
169-
"Can't instantiate abstract class TestResource with abstract methods init, shutdown",
170-
str(context.exception),
171-
)
168+
self.assertIn("Can't instantiate abstract class TestResource", str(context.exception))
169+
self.assertIn("init, shutdown", str(context.exception))
170+
172171

173172
def test_init_class_abc_shutdown_definition_is_required(self):
174173
class TestResource(resources.Resource):
@@ -178,10 +177,8 @@ def init(self):
178177
with self.assertRaises(TypeError) as context:
179178
TestResource()
180179

181-
self.assertEqual(
182-
"Can't instantiate abstract class TestResource with abstract method shutdown",
183-
str(context.exception),
184-
)
180+
self.assertIn("Can't instantiate abstract class TestResource", str(context.exception))
181+
self.assertIn("shutdown", str(context.exception))
185182

186183
def test_init_not_callable(self):
187184
provider = providers.Resource(1)
@@ -507,10 +504,8 @@ class TestAsyncResource(resources.AsyncResource):
507504
with self.assertRaises(TypeError) as context:
508505
TestAsyncResource()
509506

510-
self.assertEqual(
511-
"Can't instantiate abstract class TestAsyncResource with abstract methods init, shutdown",
512-
str(context.exception),
513-
)
507+
self.assertIn("Can't instantiate abstract class TestAsyncResource", str(context.exception))
508+
self.assertIn("init, shutdown", str(context.exception))
514509

515510
def test_init_async_class_abc_shutdown_definition_is_required(self):
516511
class TestAsyncResource(resources.AsyncResource):
@@ -520,10 +515,8 @@ async def init(self):
520515
with self.assertRaises(TypeError) as context:
521516
TestAsyncResource()
522517

523-
self.assertEqual(
524-
"Can't instantiate abstract class TestAsyncResource with abstract method shutdown",
525-
str(context.exception),
526-
)
518+
self.assertIn("Can't instantiate abstract class TestAsyncResource", str(context.exception))
519+
self.assertIn("shutdown", str(context.exception))
527520

528521
def test_init_with_error(self):
529522
async def _init():

0 commit comments

Comments
 (0)