code: def testBodyRaisesException(self):
      cm = TestContextManager()
  
      def body(var):
          cm.log.append("body(%r)" % var)
          raise ValueError("Foo")
  
      with self.assertRaisesRegexp(ValueError, "Foo"):
          _py_context_manager.test_py_context_manager(cm, body)
      self.assertRegex("\n".join(cm.log), EXCEPTION_LOG)
  
file_path: tensorflow-upstream/tensorflow/python/framework/py_context_manager_test.py
imports: from tensorflow.python.framework import _py_context_manager
  from tensorflow.python.framework import test_util
  from tensorflow.python.platform import googletest
label_desc: Use image node_id 2 for calling the OpDefUtilTest obj's underlying member method code with example usage: obj.testBodyRaisesException() without return types