code: def test_all_masked_alt():
      """Run on objects and a totally masked image"""
      labels = numpy.ones((40, 40), int)
      labels[20:, :] = 2
      module, workspace = make_pipeline(
          numpy.zeros((40, 40)),
          numpy.zeros((40, 40), bool),
          0.25,
          0.25,
          10,
          16,
          labels,
      )
      assert isinstance(
          module,
          cellprofiler.modules.measuregranularity.MeasureGranularity,
      )
      module.run(workspace)
      m = workspace.measurements
      assert isinstance(m, cellprofiler_core.measurement.Measurements)
      for i in range(1, 16):
          feature = module.granularity_feature(i, IMAGE_NAME)
          assert feature in m.get_feature_names("Image")
          value = m.get_current_image_measurement(feature)
          assert numpy.isnan(value)
          values = m.get_current_measurement(OBJECTS_NAME, feature)
          assert len(values) == 2
          assert numpy.all(numpy.isnan(values)) or numpy.all(
              values == 0
          )
  
imports: import sys
  import numpy
  import six.moves
  import cellprofiler_core.image
  import cellprofiler.modules.measuregranularity
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.workspace
  import tests.frontend.modules
label_desc: Use image node_id 9 for calling a global function with example usage: test_all_masked_alt() without return types