code: def test_splines():
      for (
          automatic,
          bg_mode,
          spline_points,
          threshold,
          convergence,
          offset,
          hi,
          lo,
          succeed,
      ) in (
          (
              True,
              MODE_AUTO,
              5,
              2,
              0.001,
              0,
              True,
              False,
              True,
          ),
          (
              True,
              MODE_AUTO,
              5,
              2,
              0.001,
              0.7,
              False,
              True,
              True,
          ),
          (
              True,
              MODE_AUTO,
              5,
              2,
              0.001,
              0.5,
              True,
              True,
              True,
          ),
          (
              False,
              MODE_AUTO,
              5,
              2,
              0.001,
              0,
              True,
              False,
              True,
          ),
          (
              False,
              MODE_AUTO,
              5,
              2,
              0.001,
              0.7,
              False,
              True,
              True,
          ),
          (
              False,
              MODE_AUTO,
              5,
              2,
              0.001,
              0.5,
              True,
              True,
              True,
          ),
          (
              False,
              MODE_BRIGHT,
              5,
              2,
              0.001,
              0.7,
              False,
              True,
              True,
          ),
          (
              False,
              MODE_DARK,
              5,
              2,
              0.001,
              0,
              True,
              False,
              True,
          ),
          (
              False,
              MODE_GRAY,
              5,
              2,
              0.001,
              0.5,
              True,
              True,
              True,
          ),
          (
              False,
              MODE_AUTO,
              7,
              2,
              0.001,
              0,
              True,
              False,
              True,
          ),
          (
              False,
              MODE_AUTO,
              4,
              2,
              0.001,
              0,
              True,
              False,
              True,
          ),
          (
              False,
              MODE_DARK,
              5,
              2,
              0.001,
              0.7,
              False,
              True,
              False,
          ),
          (
              False,
              MODE_BRIGHT,
              5,
              2,
              0.001,
              0,
              True,
              False,
              False,
          ),
      ):
          #
          # Make an image with a random background
          #
          numpy.random.seed(35)
          image = numpy.random.uniform(size=(21, 31)) * 0.05 + offset
          if hi:
              #
              # Add some "foreground" pixels
              #
              fg = numpy.random.permutation(400)[:100]
              image[
                  fg % image.shape[0], (fg / image.shape[0]).astype(int)
              ] *= 10
          if lo:
              #
              # Add some "background" pixels
              #
              bg = numpy.random.permutation(400)[:100]
              image[
                  bg % image.shape[0], (bg / image.shape[0]).astype(int)
              ] -= offset
  
          #
          # Make a background function
          #
          ii, jj = numpy.mgrid[-10:11, -15:16]
          bg = ((ii.astype(float) / 10) ** 2) * (
              (jj.astype(float) / 15) ** 2
          )
          bg *= 0.2
          image += bg
  
          workspaces, module = make_workspaces(((image, None),))
          assert isinstance(
              module,
              cellprofiler.modules.correctilluminationcalculate.CorrectIlluminationCalculate,
          )
          module.intensity_choice.value = (
              cellprofiler.modules.correctilluminationcalculate.IC_BACKGROUND
          )
          module.each_or_all.value = (
              cellprofiler.modules.correctilluminationcalculate.EA_EACH
          )
          module.rescale_option.value = "No"
          module.smoothing_method.value = (
              cellprofiler.modules.correctilluminationcalculate.SM_SPLINES
          )
          module.automatic_splines.value = automatic
          module.spline_bg_mode.value = bg_mode
          module.spline_convergence.value = convergence
          module.spline_threshold.value = threshold
          module.spline_points.value = spline_points
          module.spline_rescale.value = 1
          module.prepare_group(workspaces[0], {}, [1])
          module.run(workspaces[0])
          img = workspaces[0].image_set.get_image(OUTPUT_IMAGE_NAME)
          pixel_data = img.pixel_data
          diff = pixel_data - numpy.min(pixel_data) - bg
          if succeed:
              assert numpy.all(diff < 0.05)
          else:
              assert not numpy.all(diff < 0.05)
  
imports: import numpy
  import pytest
  from centrosome.bg_compensate import MODE_AUTO, MODE_BRIGHT, MODE_DARK, MODE_GRAY
  from six.moves import StringIO
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  import cellprofiler.modules.correctilluminationcalculate
  import cellprofiler_core.modules.injectimage
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.setting
  import cellprofiler_core.workspace
  import tests.frontend.modules
label_desc: Use image node_id 14 for calling a global function with example usage: test_splines() without return types