code: def testStartCapture_MidCapture(self):
      start_time = 1.0
      captor = self.midi_hub.start_capture(120, start_time)
  
      # Receive the first 6 messages.
      for msg in self.capture_messages[0:6]:
          self.port.callback(msg)
      time.sleep(0.1)
  
      end_time = 3.5
      captured_seq = captor.captured_sequence(end_time)
      expected_seq = music_pb2.NoteSequence()
      expected_seq.tempos.add(qpm=120)
      expected_seq.total_time = end_time
      testing_lib.add_track_to_sequence(
          expected_seq, 0, [Note(1, 64, 2, 3.5), Note(2, 64, 3, 3.5)]
      )
      self.assertProtoEquals(captured_seq, expected_seq)
  
      end_time = 4.5
      captured_seq = captor.captured_sequence(end_time)
      expected_seq = music_pb2.NoteSequence()
      expected_seq.tempos.add(qpm=120)
      expected_seq.total_time = end_time
      testing_lib.add_track_to_sequence(
          expected_seq,
          0,
          [
              Note(1, 64, 2, 4.5),
              Note(2, 64, 3, 4.5),
              Note(3, 64, 4, 4.5),
          ],
      )
      self.assertProtoEquals(captured_seq, expected_seq)
  
      end_time = 6.0
      captured_seq = captor.captured_sequence(end_time)
      expected_seq = music_pb2.NoteSequence()
      expected_seq.tempos.add(qpm=120)
      expected_seq.total_time = end_time
      testing_lib.add_track_to_sequence(
          expected_seq,
          0,
          [Note(1, 64, 2, 6), Note(2, 64, 3, 6), Note(3, 64, 4, 6)],
      )
      self.assertProtoEquals(captured_seq, expected_seq)
  
      # Receive the rest of the messages.
      for msg in self.capture_messages[6:]:
          self.port.callback(msg)
      time.sleep(0.1)
  
      end_time = 6.0
      captured_seq = captor.captured_sequence(end_time)
      expected_seq = music_pb2.NoteSequence()
      expected_seq.tempos.add(qpm=120)
      expected_seq.total_time = end_time
      testing_lib.add_track_to_sequence(
          expected_seq,
          0,
          [Note(1, 64, 2, 5), Note(2, 64, 3, 4), Note(3, 64, 4, 6)],
      )
      self.assertProtoEquals(captured_seq, expected_seq)
  
      captor.stop()
  
imports: import collections
  import queue
  import threading
  import time
  from magenta.common import concurrency
  from magenta.interfaces.midi import midi_hub
  import mido
  from note_seq import testing_lib
  from note_seq.protobuf import music_pb2
  import tensorflow.compat.v1
label_desc: Use image node_id 18 for calling the MidiHubTest obj's underlying member method code with example usage: obj.testStartCapture_MidCapture() without return types