mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
bpo-32299: Return patched dict when using patch.dict as a context manager (GH-11062)
This commit is contained in:
parent
eb65e2443a
commit
04530812e9
4 changed files with 20 additions and 1 deletions
|
@ -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 = {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue