code: def test_raises():
      with assert_raises(
          RuntimeError,
          glob="Input must have at least two dimensions - outermost for sequence and"
          " at least one for data elements.",
      ):
          check_element_extract([4], "F", [1, 3], "cpu")
  
      for shape, layout in [([6, 1], "XF"), ([8, 10, 3], "HWC")]:
          with assert_raises(
              RuntimeError,
              glob="Input layout must describe a sequence - it must start with 'F',"
              " got '*' instead.",
          ):
              check_element_extract(shape, layout, [1, 3], "cpu")
  
      with assert_raises(
          RuntimeError,
          glob="Index `10` from `element_map` is out of bounds for sample with"
          " sequence length equal `6`",
      ):
          check_element_extract([6, 1], "FX", [10], "cpu")
  
      with assert_raises(
          RuntimeError,
          glob="Negative indices in `element_map` are not allowed, found: -5",
      ):
          check_element_extract([6, 1], "FX", [-5], "cpu")
  
file_path: DALI/dali/test/python/operator_1/test_element_extract.py
imports: from nvidia.dali.pipeline import Pipeline
  from nvidia.dali import fn, pipeline_def
  import nvidia.dali.ops
  from test_utils import RandomlyShapedDataIterator, to_array
  from nose_utils import assert_raises
  import numpy
label_desc: Use image node_id 5 for calling a global function with example usage: test_raises() without return types