summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unittest/testmock/testasync.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_unittest/testmock/testasync.py')
-rw-r--r--Lib/test/test_unittest/testmock/testasync.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_unittest/testmock/testasync.py b/Lib/test/test_unittest/testmock/testasync.py
index 1bab671..e05a228 100644
--- a/Lib/test/test_unittest/testmock/testasync.py
+++ b/Lib/test/test_unittest/testmock/testasync.py
@@ -149,6 +149,23 @@ class AsyncPatchCMTest(unittest.TestCase):
run(test_async())
+ def test_patch_dict_async_def(self):
+ foo = {'a': 'a'}
+ @patch.dict(foo, {'a': 'b'})
+ async def test_async():
+ self.assertEqual(foo['a'], 'b')
+
+ self.assertTrue(iscoroutinefunction(test_async))
+ run(test_async())
+
+ def test_patch_dict_async_def_context(self):
+ foo = {'a': 'a'}
+ async def test_async():
+ with patch.dict(foo, {'a': 'b'}):
+ self.assertEqual(foo['a'], 'b')
+
+ run(test_async())
+
class AsyncMockTest(unittest.TestCase):
def test_iscoroutinefunction_default(self):