code: def test_03_03_initial_measurements(self):
      #
      # Walk to the initial measurements
      #
      self.awthread = self.AWThread(self.work_addr, self.zmq_context)
      self.awthread.start()
      self.set_work_socket()
      work_reply = anareply.Work(
          image_set_numbers=[1],
          worker_runs_post_group=False,
          wants_dictionary=True,
      )
      self.awthread.ex(
          self.awthread.aw.do_job,
          work_reply,
      )
      #
      # The worker should ask for the pipeline and preferences next.
      #
      req = self.awthread.recv(self.work_socket)
      self.assertIsInstance(req, anarequest.PipelinePreferences)
      self.assertEqual(req.analysis_id, self.analysis_id)
  
      input_dir = os.path.abspath(
          os.path.join(
              os.path.dirname(tests.core.__file__),
              "data/ExampleSBSImages",
          )
      )
  
      cellprofiler_core.preferences.set_default_image_directory(
          input_dir
      )
      preferences = {
          cellprofiler_core.preferences.DEFAULT_IMAGE_DIRECTORY: cellprofiler_core.preferences.config_read(
              cellprofiler_core.preferences.DEFAULT_IMAGE_DIRECTORY
          )
      }
  
      rep = cellprofiler_core.utilities.zmq.Reply(
          pipeline_blob=numpy.array(GOOD_PIPELINE),
          preferences=preferences,
      )
      req.reply(rep)
      #
      # The worker asks for the initial measurements.
      #
      req = self.awthread.recv(self.work_socket)
      self.assertIsInstance(req, anarequest.InitialMeasurements)
      self.assertEqual(req.analysis_id, self.analysis_id)
      m = get_measurements_for_good_pipeline()
      try:
          req.reply(
              cellprofiler_core.utilities.zmq.Reply(
                  buf=m.file_contents()
              )
          )
          req = self.awthread.recv(self.work_socket)
          #
          # Check that they were installed
          #
          assert self.awthread.aw.initial_measurements is not None
          cm = self.awthread.aw.initial_measurements
          for object_name in m.get_object_names():
              for feature_name in m.get_feature_names(object_name):
                  self.assertTrue(
                      cm.has_feature(object_name, feature_name)
                  )
                  if (
                      feature_name
                      == cellprofiler_core.modules.namesandtypes.M_IMAGE_SET
                  ):
                      numpy.testing.assert_array_equal(
                          cm[object_name, feature_name, 1],
                          m[object_name, feature_name, 1],
                      )
                  else:
                      self.assertEqual(
                          cm[object_name, feature_name, 1],
                          m[object_name, feature_name, 1],
                      )
          #
          # Cancel and check for exit
          #
          req.reply(anareply.ServerExited())
          self.assertRaises(
              cellprofiler_core.pipeline.event.CancelledException,
              self.awthread.ecute,
          )
      finally:
          m.close()
  
imports: import io
  import queue
  import time
  import os
  import pytest
  import pickle
  import tempfile
  import threading
  import traceback
  import unittest
  import uuid
  import zlib
  import numpy
  import zmq
  import cellprofiler_core.analysis
  import cellprofiler_core.analysis.reply
  import cellprofiler_core.constants.measurement
  import cellprofiler_core.constants.worker
  import cellprofiler_core.measurement
  import cellprofiler_core.module._identify
  import cellprofiler_core.modules.namesandtypes
  import cellprofiler_core.pipeline
  import cellprofiler_core.preferences
  import cellprofiler_core.utilities.image
  import cellprofiler_core.utilities.measurement
  import cellprofiler_core.utilities.pathname
  import cellprofiler_core.utilities.zmq
  import cellprofiler_core.worker
  import cellprofiler_core.analysis.request
  from cellprofiler_core.constants.modules.namesandtypes import M_IMAGE_SET_ZIP_DICTIONARY
  from cellprofiler_core.pipeline import ImageFile
  from cellprofiler_core.pipeline import ImagePlane
  import tests.core
  import tests.core.modules
label_desc: Use image node_id 14 for calling the TestAnalysisWorker obj's underlying member method code with example usage: obj.test_03_03_initial_measurements() without return types