code: def test_delattr_ctx(self):
      # Test temporary removal of attributes
      a = self.module.a
      b = self.module.b
      with delattr_ctx(self.module, "a", "b"):
          self.assertIsNone(getattr(self.module, "a", None))
          self.assertIsNone(getattr(self.module, "b", None))
          self.assertTrue(self.module.c is not None)
  
      # Test that removed attributes get restored
      self.assertTrue(self.module.a.equal(a))
      self.assertTrue(self.module.b.equal(b))
  
      with self.assertRaisesRegex(ValueError, "Attribute .* missing"):
          with delattr_ctx(self.module, "z", enforce_hasattr=True):
              pass
  
file_path: botorch/test/utils/test_context_managers.py
imports: from __future__ import annotations
  from string import ascii_lowercase
  import torch
  from botorch.utils.context_managers import delattr_ctx, module_rollback_ctx, parameter_rollback_ctx, requires_grad_ctx, TensorCheckpoint, zero_grad_ctx
  from botorch.utils.testing import BotorchTestCase
  from torch.nn import Module, Parameter
label_desc: Use image node_id 2 for calling the TestContextManagers obj's underlying member method code with example usage: obj.test_delattr_ctx() without return types