code: def test_measurements_new_primary():
      module = (
          cellprofiler.modules.identifysecondaryobjects.IdentifySecondaryObjects()
      )
      module.wants_discard_edge.value = True
      module.wants_discard_primary.value = True
      module.x_name.value = INPUT_OBJECTS_NAME
      module.y_name.value = OUTPUT_OBJECTS_NAME
      module.new_primary_objects_name.value = NEW_OBJECTS_NAME
  
      categories = module.get_categories(None, "Image")
      assert len(categories) == 2
      assert all(
          [
              any([x == y for x in categories])
              for y in ("Count", "Threshold")
          ]
      )
      categories = module.get_categories(None, OUTPUT_OBJECTS_NAME)
      assert len(categories) == 3
      assert all(
          [
              any([x == y for x in categories])
              for y in ("Location", "Parent", "Number")
          ]
      )
      categories = module.get_categories(None, INPUT_OBJECTS_NAME)
      assert len(categories) == 1
      assert categories[0] == "Children"
  
      categories = module.get_categories(None, NEW_OBJECTS_NAME)
      assert len(categories) == 4
      assert all(
          [
              any([x == y for x in categories])
              for y in ("Location", "Parent", "Children", "Number")
          ]
      )
  
      features = module.get_measurements(None, "Image", "Count")
      assert len(features) == 2
      assert OUTPUT_OBJECTS_NAME in features
      assert NEW_OBJECTS_NAME in features
  
      features = module.get_measurements(None, "Image", "Threshold")
      threshold_features = (
          "OrigThreshold",
          "FinalThreshold",
          "WeightedVariance",
          "SumOfEntropies",
      )
      assert len(features) == 4
      assert all(
          [any([x == y for x in features]) for y in threshold_features]
      )
      for threshold_feature in threshold_features:
          objects = module.get_measurement_objects(
              None, "Image", "Threshold", threshold_feature
          )
          assert len(objects) == 1
          assert objects[0] == OUTPUT_OBJECTS_NAME
  
      features = module.get_measurements(
          None, INPUT_OBJECTS_NAME, "Children"
      )
      assert len(features) == 2
      assert all(
          [
              any([x == y for x in features])
              for y in (
                  "%s_Count" % OUTPUT_OBJECTS_NAME,
                  "%s_Count" % NEW_OBJECTS_NAME,
              )
          ]
      )
  
      features = module.get_measurements(
          None, OUTPUT_OBJECTS_NAME, "Parent"
      )
      assert len(features) == 2
      assert all(
          [
              any([x == y for x in features])
              for y in (INPUT_OBJECTS_NAME, NEW_OBJECTS_NAME)
          ]
      )
  
      for oname in (OUTPUT_OBJECTS_NAME, NEW_OBJECTS_NAME):
          features = module.get_measurements(None, oname, "Location")
          assert len(features) == 3
          assert all(
              [
                  any([x == y for x in features])
                  for y in ("Center_X", "Center_Y", "Center_Z")
              ]
          )
  
      columns = module.get_measurement_columns(None)
      expected_columns = [
          (
              "Image",
              "Threshold_%s_%s" % (f, OUTPUT_OBJECTS_NAME),
              COLTYPE_FLOAT,
          )
          for f in threshold_features
      ]
      for oname in (NEW_OBJECTS_NAME, OUTPUT_OBJECTS_NAME):
          expected_columns += [
              (
                  "Image",
                  FF_COUNT % oname,
                  COLTYPE_INTEGER,
              ),
              (
                  INPUT_OBJECTS_NAME,
                  "Children_%s_Count" % oname,
                  COLTYPE_INTEGER,
              ),
              (oname, "Location_Center_X", COLTYPE_FLOAT),
              (oname, "Location_Center_Y", COLTYPE_FLOAT),
              (oname, "Location_Center_Z", COLTYPE_FLOAT),
              (
                  oname,
                  "Number_Object_Number",
                  COLTYPE_INTEGER,
              ),
              (oname, "Parent_Primary", COLTYPE_INTEGER),
          ]
      expected_columns += [
          (
              NEW_OBJECTS_NAME,
              "Children_%s_Count" % OUTPUT_OBJECTS_NAME,
              COLTYPE_INTEGER,
          ),
          (
              OUTPUT_OBJECTS_NAME,
              "Parent_%s" % NEW_OBJECTS_NAME,
              COLTYPE_INTEGER,
          ),
      ]
      assert len(columns) == len(expected_columns)
      for column in expected_columns:
          assert any(
              [
                  all(
                      [
                          fa == fb
                          for fa, fb in zip(column, expected_column)
                      ]
                  )
                  for expected_column in expected_columns
              ]
          )
  
imports: import io
  import centrosome.threshold
  import numpy
  from cellprofiler_core.constants.measurement import FF_COUNT, COLTYPE_FLOAT, COLTYPE_INTEGER, R_FIRST_IMAGE_NUMBER, R_SECOND_IMAGE_NUMBER, R_FIRST_OBJECT_NUMBER, R_SECOND_OBJECT_NUMBER
  from cellprofiler_core.constants.module._identify import TS_GLOBAL, O_TWO_CLASS, O_FOREGROUND
  import tests.frontend.modules
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  import cellprofiler.modules.identifysecondaryobjects
  import cellprofiler.modules.threshold
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.preferences
  import cellprofiler_core.workspace
label_desc: Use image node_id 18 for calling a global function with example usage: test_measurements_new_primary() without return types