def test_wrapper(self):
    'Create a test instance and verify the wrapper redirects.'
    obj = self.DummyClass()
    wrapped = tools.ContextManagerWrapper(obj)
    self.assertIs(wrapped.class_var, obj.class_var)
    self.assertIs(wrapped.instance_var, obj.instance_var)
    self.assertIs(wrapped._wrapped, obj)
    self.assertFalse(obj.closed)
    with wrapped as unwrapped:
        self.assertFalse(obj.closed)
        self.assertIs(unwrapped, obj)
        unwrapped.class_var = 47
    self.assertTrue(obj.closed)
    self.assertEqual(wrapped.class_var, 47)
Create a test instance and verify the wrapper redirects.
def test_wrapper(self):
    
    obj = self.DummyClass()
    wrapped = tools.ContextManagerWrapper(obj)
    self.assertIs(wrapped.class_var, obj.class_var)
    self.assertIs(wrapped.instance_var, obj.instance_var)
    self.assertIs(wrapped._wrapped, obj)
    self.assertFalse(obj.closed)
    with wrapped as unwrapped:
        self.assertFalse(obj.closed)
        self.assertIs(unwrapped, obj)
        unwrapped.class_var = 47
    self.assertTrue(obj.closed)
    self.assertEqual(wrapped.class_var, 47)