code: def testMelodyExtractor(self):
      note_sequence = common_testing_lib.parse_test_proto(
          music_pb2.NoteSequence,
          """
          time_signatures: {
            numerator: 4
            denominator: 4}
          tempos: {
            qpm: 60}""",
      )
      music_testing_lib.add_track_to_sequence(
          note_sequence, 0, [(12, 100, 2, 4), (11, 1, 6, 7)]
      )
      music_testing_lib.add_track_to_sequence(
          note_sequence, 1, [(12, 127, 2, 4), (14, 50, 6, 8)]
      )
      quantized_sequence = sequences_lib.quantize_note_sequence(
          note_sequence, steps_per_quarter=1
      )
      expected_events = [
          [NO_EVENT, NO_EVENT, 12, NO_EVENT, NOTE_OFF, NO_EVENT, 11],
          [
              NO_EVENT,
              NO_EVENT,
              12,
              NO_EVENT,
              NOTE_OFF,
              NO_EVENT,
              14,
              NO_EVENT,
          ],
      ]
      expected_melodies = []
      for events_list in expected_events:
          melody = melodies_lib.Melody(
              events_list, steps_per_quarter=1, steps_per_bar=4
          )
          expected_melodies.append(melody)
      unit = melody_pipelines.MelodyExtractor(
          min_bars=1, min_unique_pitches=1, gap_bars=1
      )
      self._unit_transform_test(
          unit, quantized_sequence, expected_melodies
      )
  
imports: from absl.testing import absltest
  from magenta.common import testing_lib
  from magenta.pipelines import melody_pipelines
  from note_seq import constants
  from note_seq import melodies_lib
  from note_seq import sequences_lib
  from note_seq import testing_lib
  from note_seq.protobuf import music_pb2
label_desc: Use image node_id 3 for calling the MelodyPipelinesTest obj's underlying member method code with example usage: obj.testMelodyExtractor() without return types