code: def test_expand_dims_throw_error():
      args = [
          (
              [4],
              None,
              None,
              [(10, 20, 30)],
              r"Data has not enough dimensions to add new axes at specified indices.",
          ),
          (
              [0, -1],
              None,
              None,
              [(10, 20, 30)],
              r"Axis value can't be negative",
          ),
          (
              [2, 0, 2],
              "AB",
              "XYZ",
              [(10, 20, 30)],
              r"Specified [\d]+ new dimensions, but layout contains only [\d]+ new dimension names",
          ),
          (
              [2],
              "C",
              None,
              [(10, 20, 30)],
              r"Specifying ``new_axis_names`` requires an input with a proper layout.",
          ),
      ]
      for axes, new_axis_names, layout, shapes, err_msg in args:
          pipe = expand_dims_pipe(
              batch_size=len(shapes),
              num_threads=1,
              device_id=0,
              shapes=shapes,
              axes=axes,
              new_axis_names=new_axis_names,
              layout=layout,
          )
          with assert_raises(RuntimeError, regex=err_msg):
              pipe.build()
              pipe.run()
  
file_path: DALI/dali/test/python/operator_1/test_expand_dims.py
imports: from nvidia.dali import pipeline_def
  import nvidia.dali.fn
  import numpy
  from nose_utils import assert_raises
label_desc: Use image node_id 5 for calling a global function with example usage: test_expand_dims_throw_error() without return types