code: def test_dict_context_manager(self):
      foo = {}
      with patch.dict(foo, {"a": "b"}):
          self.assertEqual(foo, {"a": "b"})
      self.assertEqual(foo, {})
  
      with self.assertRaises(NameError):
          with patch.dict(foo, {"a": "b"}):
              self.assertEqual(foo, {"a": "b"})
              raise NameError("Konrad")
  
      self.assertEqual(foo, {})
  
imports: import unittest
  from warnings import catch_warnings
  from test.test_unittest.testmock.support import is_instance
  from unittest.mock import MagicMock, Mock, patch, sentinel, mock_open, call
label_desc: Use image node_id 11 for calling the WithTest obj's underlying member method code with example usage: obj.test_dict_context_manager() without return types