diff options
Diffstat (limited to 'Lib/unittest/test/testmock/testpatch.py')
-rw-r--r-- | Lib/unittest/test/testmock/testpatch.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/testpatch.py b/Lib/unittest/test/testmock/testpatch.py index 3295c5b242..27914a9d71 100644 --- a/Lib/unittest/test/testmock/testpatch.py +++ b/Lib/unittest/test/testmock/testpatch.py @@ -619,6 +619,13 @@ class PatchTest(unittest.TestCase): self.assertEqual(foo.values, original) + def test_patch_dict_as_context_manager(self): + foo = {'a': 'b'} + with patch.dict(foo, a='c') as patched: + self.assertEqual(patched, {'a': 'c'}) + self.assertEqual(foo, {'a': 'b'}) + + def test_name_preserved(self): foo = {} |