code: def test_safe_map_errors(self):
      with self.assertRaisesRegex(
          TypeError, "safe_map requires at least 2 arguments"
      ):
          util.safe_map()
  
      with self.assertRaisesRegex(
          TypeError, "safe_map requires at least 2 arguments"
      ):
          util.safe_map(lambda x: x)
  
      with self.assertRaisesRegex(
          TypeError, "'int' object is not callable"
      ):
          util.safe_map(7, range(6))
  
      def error(*args, **kwargs):
          raise RuntimeError("hello")
  
      with self.assertRaisesRegex(RuntimeError, "hello"):
          util.safe_map(error, range(6))
  
      with self.assertRaisesRegex(
          ValueError,
          r"safe_map\(\) argument 2 is longer than argument 1",
      ):
          util.safe_map(operator.add, range(3), range(4))
  
      with self.assertRaisesRegex(
          ValueError,
          r"safe_map\(\) argument 2 is shorter than argument 1",
      ):
          util.safe_map(operator.add, range(7), range(2))
  
      with self.assertRaisesRegex(
          ValueError,
          r"safe_map\(\) argument 2 is longer than argument 1",
      ):
          util.safe_map(operator.add, (), range(3))
  
file_path: jax/tests/util_test.py
imports: import operator
  from absl.testing import absltest
  from jax._src import linear_util
  from jax._src import test_util
  from jax._src import util
  from jax import config
  from jax._src.util import weakref_lru_cache
label_desc: Use image node_id 2 for calling the SafeMapTest obj's underlying member method code with example usage: obj.test_safe_map_errors() without return types