summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test/testmock
diff options
context:
space:
mode:
authorXtreak <tir.karthi@gmail.com>2019-09-09 09:04:57 (GMT)
committerLisa Roach <lisaroach14@gmail.com>2019-09-09 09:04:57 (GMT)
commitaa515082749687c1e3bc9ec5e2296368191b9f84 (patch)
tree368050a77c01ec3c2d3337ad9529fbe3c1cb2cd5 /Lib/unittest/test/testmock
parent526a01467b3277f9fcf7f91e66c23321caa1245d (diff)
downloadcpython-aa515082749687c1e3bc9ec5e2296368191b9f84.zip
cpython-aa515082749687c1e3bc9ec5e2296368191b9f84.tar.gz
cpython-aa515082749687c1e3bc9ec5e2296368191b9f84.tar.bz2
Fix assertions regarding magic methods function body that was not executed (GH-14154)
Diffstat (limited to 'Lib/unittest/test/testmock')
-rw-r--r--Lib/unittest/test/testmock/testasync.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/Lib/unittest/test/testmock/testasync.py b/Lib/unittest/test/testmock/testasync.py
index fa906e4..865cfdc 100644
--- a/Lib/unittest/test/testmock/testasync.py
+++ b/Lib/unittest/test/testmock/testasync.py
@@ -361,17 +361,14 @@ class AsyncArguments(unittest.TestCase):
class AsyncContextManagerTest(unittest.TestCase):
+
class WithAsyncContextManager:
- def __init__(self):
- self.entered = False
- self.exited = False
async def __aenter__(self, *args, **kwargs):
- self.entered = True
return self
async def __aexit__(self, *args, **kwargs):
- self.exited = True
+ pass
def test_magic_methods_are_async_mocks(self):
mock = MagicMock(self.WithAsyncContextManager())
@@ -390,11 +387,7 @@ class AsyncContextManagerTest(unittest.TestCase):
return result
result = asyncio.run(use_context_manager())
- self.assertFalse(instance.entered)
- self.assertFalse(instance.exited)
self.assertTrue(called)
- self.assertTrue(mock_instance.entered)
- self.assertTrue(mock_instance.exited)
self.assertTrue(mock_instance.__aenter__.called)
self.assertTrue(mock_instance.__aexit__.called)
self.assertIsNot(mock_instance, result)