code: def test_empty_es():
      max_batch_size = 16
  
      @pipeline_def
      def pipeline():
          return fn.external_source(source=lambda: [])
  
      # Providing an empty batch was legal, but it failed on MakeContiguous node.
      # This checks proper validation in External Source which is the only way that could provide
      # empty batch as input into DALI graph.
      with assert_raises(
          RuntimeError,
          glob="*ExternalSource expects non-empty batches*",
      ):
          pipe = pipeline(
              batch_size=max_batch_size, num_threads=4, device_id=0
          )
          pipe.build()
          pipe.run()
  
imports: import random
  import nvidia.dali.fn
  import nvidia.dali.ops
  import nvidia.dali.types
  import numpy
  from nvidia.dali import Pipeline, pipeline_def
  from test_utils import check_batch
  from nose_utils import raises, assert_warns, assert_raises
  from nvidia.dali.types import DALIDataType
  from numpy.random import default_rng
label_desc: Use image node_id 31 for calling a global function with example usage: test_empty_es() and returns: fn