code: def testExtractLeadSheetFragments(self):
      music_testing_lib.add_track_to_sequence(
          self.note_sequence, 0, [(12, 100, 0.5, 1), (11, 1, 1.5, 2.75)]
      )
      music_testing_lib.add_track_to_sequence(
          self.note_sequence,
          1,
          [
              (12, 127, 0.5, 1),
              (14, 50, 1.5, 2),
              (50, 100, 8.25, 9.25),
              (52, 100, 8.5, 9.25),
          ],
      )
      music_testing_lib.add_chords_to_sequence(
          self.note_sequence, [("C", 0.5), ("G7", 1.5), ("Cmaj7", 8.25)]
      )
      quantized_sequence = sequences_lib.quantize_note_sequence(
          self.note_sequence, self.steps_per_quarter
      )
      (
          lead_sheets,
          _,
      ) = lead_sheet_pipelines.extract_lead_sheet_fragments(
          quantized_sequence,
          min_bars=1,
          gap_bars=2,
          min_unique_pitches=2,
          ignore_polyphonic_notes=True,
          require_chords=True,
      )
      melodies, _ = melody_pipelines.extract_melodies(
          quantized_sequence,
          min_bars=1,
          gap_bars=2,
          min_unique_pitches=2,
          ignore_polyphonic_notes=True,
      )
      (
          chord_progressions,
          _,
      ) = chord_pipelines.extract_chords_for_melodies(
          quantized_sequence, melodies
      )
      self.assertEqual(
          list(melodies),
          list(lead_sheet.melody for lead_sheet in lead_sheets),
      )
      self.assertEqual(
          list(chord_progressions),
          list(lead_sheet.chords for lead_sheet in lead_sheets),
      )
  
imports: from absl.testing import absltest
  from magenta.common import testing_lib
  from magenta.pipelines import chord_pipelines
  from magenta.pipelines import lead_sheet_pipelines
  from magenta.pipelines import melody_pipelines
  from note_seq import chords_lib
  from note_seq import constants
  from note_seq import lead_sheets_lib
  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 4 for calling the LeadSheetPipelinesTest obj's underlying member method code with example usage: obj.testExtractLeadSheetFragments() without return types