code: def test_sample_with_no_masks():
      # NOTE:
      # ---
      # Temporarily disable this test as it will fail currently.
      # The DataPipeline class currently does not handle images
      # that do not have associated masks. When this functionality
      # has been added, this test will be reinstated.
      # ---
  
      # This is to test if the user passes data that does not contain
      # any masks, in other words a list of images rather than the
      # data structure you have in other examples in this file.
      width = 80
      height = 80
  
      tmpdir = tempfile.mkdtemp()
      tmps = []
  
      num_of_images = 10
  
      for i in range(num_of_images):
          tmps.append(
              tempfile.NamedTemporaryFile(
                  dir=tmpdir, suffix=".JPEG", delete=False
              )
          )
  
          bytestream = io.BytesIO()
  
          im = Image.new("RGB", (width, height))
          im.save(bytestream, "JPEG")
  
          tmps[i].file.write(bytestream.getvalue())
          tmps[i].flush()
  
      # Make our data structures
      # Labels
      y = [
          0 if random.random() <= 0.5 else 1
          for x in range(0, num_of_images)
      ]
      # Image data
      images = [np.asarray(x) for x in tmps]
  
      p = Augmentor.DataPipeline(images)
      assert len(p.augmentor_images) == len(
          glob.glob(os.path.join(tmpdir, "*.JPEG"))
      )
  
      p.rotate(probability=1, max_left_rotation=5, max_right_rotation=5)
  
      sample_size = 100
      augmented_images = p.sample(sample_size)
  
      assert len(augmented_images) == sample_size
  
      # Close all temporary files which will also delete them automatically
      for i in range(len(tmps)):
          tmps[i].close()
  
      # Finally remove the directory (and everything in it) as mkdtemp does
      # not delete itself after closing automatically
      shutil.rmtree(tmpdir)
  
file_path: Augmentor/tests/test_datapipeline.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from builtins import *
  import os
  import sys
  import Augmentor
  from PIL import Image
  import tempfile
  import io
  import shutil
  import glob
  import random
  import numpy
  import pytest
label_desc: Use image node_id 1 for calling a global function with example usage: test_sample_with_no_masks() without return types