code: def test_last_is_nan():
      # regression test for issue #1553
      #
      # Test that classify objects classifies an object whose measurement
      # is NaN as none of the categories. Test for no exception thrown
      # if showing the figure and last object has a measurement of NaN
      #
      for leave_last_out in (False, True):
          m = numpy.array((0.5, 0, 1, numpy.NaN))
          if leave_last_out:
              m = m[:-1]
          labels = numpy.zeros((20, 10), int)
          labels[2:5, 3:7] = 1
          labels[12:15, 1:4] = 2
          labels[6:11, 5:9] = 3
          labels[16:19, 5:9] = 4
          workspace, module = make_workspace(
              labels,
              cellprofiler.modules.classifyobjects.BY_SINGLE_MEASUREMENT,
              m,
          )
          module.single_measurements[
              0
          ].bin_choice.value = (
              cellprofiler.modules.classifyobjects.BC_CUSTOM
          )
          module.single_measurements[
              0
          ].custom_thresholds.value = ".2,.7"
          module.single_measurements[
              0
          ].bin_count.value = 14  # should ignore
          module.single_measurements[0].wants_custom_names.value = True
          module.single_measurements[0].wants_low_bin.value = True
          module.single_measurements[0].wants_high_bin.value = True
          module.single_measurements[
              0
          ].bin_names.value = "Three,Blind,Mice"
          module.single_measurements[0].wants_images.value = True
  
          expected_img = dict(
              Classify_Three_NumObjectsPerBin=1,
              Classify_Three_PctObjectsPerBin=25.0,
              Classify_Blind_NumObjectsPerBin=1,
              Classify_Blind_PctObjectsPerBin=25.0,
              Classify_Mice_NumObjectsPerBin=1,
              Classify_Mice_PctObjectsPerBin=25.0,
          )
          expected_obj = dict(
              Classify_Three=(0, 1, 0, 0),
              Classify_Blind=(1, 0, 0, 0),
              Classify_Mice=(0, 0, 1, 0),
          )
          module.run(workspace)
          for measurement, expected_values in list(
              expected_obj.items()
          ):
              values = workspace.measurements.get_current_measurement(
                  OBJECTS_NAME, measurement
              )
              assert len(values) == 4
              assert numpy.all(values == numpy.array(expected_values))
          for measurement, expected_values in list(
              expected_img.items()
          ):
              values = workspace.measurements.get_current_measurement(
                  "Image", measurement
              )
              assert values == expected_values
          image = workspace.image_set.get_image(IMAGE_NAME)
          pixel_data = image.pixel_data
          assert numpy.all(pixel_data[labels == 0, :] == 0)
          colors = [
              pixel_data[x, y, :]
              for x, y in ((2, 3), (12, 1), (6, 5), (16, 5))
          ]
          for i, color in enumerate(colors + [colors[1]]):
              assert numpy.all(pixel_data[labels == i + 1, :] == color)
  
imports: import contextlib
  import os
  import pickle
  import tempfile
  import numpy
  import pytest
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  from cellprofiler_core.constants.measurement import COLTYPE_FLOAT, COLTYPE_INTEGER
  import cellprofiler.modules.classifyobjects
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.setting
  import cellprofiler_core.workspace
label_desc: Use image node_id 7 for calling a global function with example usage: test_last_is_nan() without return types