code: def test_reraise(self):
      class CustomError(Exception):
          def __init__(
              self, *args, **kwargs
          ):  # pylint: disable=super-init-not-called
              pass  # Do not call super() to ensure this would work with bad code.
  
      with self.assertRaisesRegex(ValueError, "Caught: "):
          with py_utils.try_reraise("Caught: "):
              raise ValueError
  
      with self.assertRaisesRegex(ValueError, "Caught: With message"):
          with py_utils.try_reraise("Caught: "):
              raise ValueError("With message")
  
      with self.assertRaisesRegex(CustomError, "Caught: 123"):
          with py_utils.try_reraise("Caught: "):
              raise CustomError(123)
  
      with self.assertRaisesRegex(CustomError, "('Caught: ', 123, {})"):
          with py_utils.try_reraise("Caught: "):
              raise CustomError(123, {})
  
      with self.assertRaisesRegex(Exception, "Caught: "):
          with py_utils.try_reraise("Caught: "):
              ex = CustomError(123, {})
              ex.args = "Not a tuple"
              raise ex
  
      with self.assertRaisesRegex(RuntimeError, "Caught: message"):
          with py_utils.try_reraise("Caught: "):
              raise tf.errors.FailedPreconditionError(
                  None, None, "message"
              )
  
imports: import collections
  import pathlib
  from etils import epath
  import pytest
  import tensorflow
  from tensorflow_datasets import testing
  from tensorflow_datasets.core import constants
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.utils import py_utils
label_desc: Use image node_id 6 for calling the PyUtilsTest obj's underlying member method code with example usage: obj.test_reraise() without return types