code: def test_simple_data_source(test_data_csv_png_20, shuffle):
      src_data = []
      with open(test_data_csv_png_20) as f:
          for l in f.readlines():
              values = [x.strip() for x in l.split(",")]
              img_file_name = os.path.join(
                  os.path.dirname(test_data_csv_png_20), values[0]
              )
              if os.path.exists(img_file_name):
                  with open(img_file_name, "rb") as img_file:
                      d = load_image(img_file)
                      src_data.append((d, int(values[1])))
  
      def test_load_func(position):
          return src_data[position]
  
      size = len(src_data)
      ds = SimpleDataSource(test_load_func, size, shuffle=shuffle)
      order = []
      for i in range(ds.size):
          data, label = ds.next()
          assert data[0][0][0] == label
          order.append(label)
      if shuffle:
          assert not list(range(size)) == order
          assert list(range(size)) == sorted(order)
      else:
          assert list(range(size)) == order
  
file_path: nnabla/python/test/utils/test_data_source.py
imports: import os
  import pytest
  from nnabla.utils.data_source_implements import SimpleDataSource, CsvDataSource, ConcatDataSource
  from nnabla.utils.data_source_loader import load_image
  from .conftest import test_data_csv_csv_10, test_data_csv_csv_20
  from .conftest import test_data_csv_png_10, test_data_csv_png_20
label_desc: Use image node_id 3 for calling a global function with example usage: test_simple_data_source(test_data_csv_png_20, shuffle) and returns: src_data