code: def test_assessor(self):
      pass
      _reverse_io()
      send(
          CommandType.ReportMetricData,
          '{"parameter_id": 0,"trial_job_id":"A","type":"PERIODICAL","sequence":0,"value":"2"}',
      )
      send(
          CommandType.ReportMetricData,
          '{"parameter_id": 1,"trial_job_id":"B","type":"PERIODICAL","sequence":0,"value":"2"}',
      )
      send(
          CommandType.ReportMetricData,
          '{"parameter_id": 0,"trial_job_id":"A","type":"PERIODICAL","sequence":1,"value":"3"}',
      )
      send(
          CommandType.TrialEnd,
          '{"trial_job_id":"A","event":"SYS_CANCELED","hyper_params":"{\\"parameter_id\\": 0}"}',
      )
      send(
          CommandType.TrialEnd,
          '{"trial_job_id":"B","event":"SUCCEEDED","hyper_params":"{\\"parameter_id\\": 1}"}',
      )
      send(CommandType.NewTrialJob, "null")
      _restore_io()
  
      assessor = NaiveAssessor()
      dispatcher = MsgDispatcher(
          "ws://_unittest_placeholder_", None, assessor
      )
      dispatcher._channel = LegacyCommandChannel()
      msg_dispatcher_base._worker_fast_exit_on_terminate = False
  
      dispatcher.run()
      e = dispatcher.worker_exceptions[0]
      self.assertIs(type(e), AssertionError)
      self.assertEqual(
          e.args[0], "Unsupported command: CommandType.NewTrialJob"
      )
  
      self.assertEqual(_trials, ["A", "B", "A"])
      self.assertEqual(_end_trials, [("A", False), ("B", True)])
  
      _reverse_io()
      command, data = receive()
      self.assertIs(command, CommandType.KillTrialJob)
      self.assertEqual(data, '"A"')
      self.assertEqual(len(_out_buf.read()), 0)
  
file_path: nni/test/ut/sdk/test_assessor.py
imports: from io import BytesIO
  import json
  from unittest import TestCase, main
  from nni.assessor import Assessor, AssessResult
  from nni.runtime import msg_dispatcher_base
  from nni.runtime.msg_dispatcher import MsgDispatcher
  from nni.runtime.tuner_command_channel.legacy import *
label_desc: Use image node_id 1 for calling the AssessorTestCase obj's underlying member method code with example usage: obj.test_assessor() without return types