code: def test_crop():
      """Turn cropping on and check that the cropping mask covers the mask"""
      image = numpy.random.uniform(size=(19, 21))
      i, j = numpy.mgrid[0:19, 0:21].astype(float)
      image = i / 100 + j / 10000
      for angle in range(10, 360, 10):
          #
          # Run the module with cropping to get the crop mask
          #
          def fn(module, angle=angle):
              assert isinstance(
                  module,
                  cellprofiler.modules.flipandrotate.FlipAndRotate,
              )
              module.flip_choice.value = (
                  cellprofiler.modules.flipandrotate.FLIP_NONE
              )
              module.rotate_choice.value = (
                  cellprofiler.modules.flipandrotate.ROTATE_ANGLE
              )
              module.angle.value = angle
              module.wants_crop.value = True
  
          crop_output_image, angle = run_module(image, fn=fn)
          crop_mask = crop_output_image.crop_mask
          crop_image = crop_output_image.pixel_data
          assert numpy.all(crop_output_image.mask[1:-1, 1:-1])
  
          #
          # Run the module without cropping to get the mask
          #
          def fn(module, angle=angle):
              assert isinstance(
                  module,
                  cellprofiler.modules.flipandrotate.FlipAndRotate,
              )
              module.flip_choice.value = (
                  cellprofiler.modules.flipandrotate.FLIP_NONE
              )
              module.rotate_choice.value = (
                  cellprofiler.modules.flipandrotate.ROTATE_ANGLE
              )
              module.angle.value = angle
              module.wants_crop.value = False
  
          output_image, angle = run_module(image, fn=fn)
          assert isinstance(
              crop_output_image, cellprofiler_core.image.Image
          )
          pixel_data = output_image.pixel_data
          slop = (
              numpy.array(pixel_data.shape) - numpy.array(image.shape)
          ) / 2
          mask = output_image.mask
  
file_path: CellProfiler/tests/frontend/modules/test_flipandrotate.py
imports: import centrosome.cpmorphology
  import numpy
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  from cellprofiler_core.constants.measurement import COLTYPE_FLOAT
  import cellprofiler.modules.flipandrotate
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.workspace
label_desc: Use image node_id 7 for calling a global function with example usage: test_crop() without return types