code: def test_sustain(self):
      # use an existing file as a start
      midi = MIDIFile(
          pj(ANNOTATIONS_PATH, "stereo_sample_sustained.mid")
      )
      # obtain all sustain messages from that file
      sustain_msgs = []
      for msg in midi:
          if msg.type == "control_change" and msg.control == 64:
              sustain_msgs.append(msg)
      # there's only a single sustain message
      self.assertTrue(len(sustain_msgs) == 4)
      # the logic adds a another sustain OFF message (i.e. value of 0)
      self.assertTrue(len(midi.sustain_messages) == 5)
      self.assertTrue(midi.sustain_messages[-1].value == 0)
      self.assertTrue(midi.sustain_messages[0] == sustain_msgs[0])
      # check notes with and without sustain information
      self.assertTrue(
          np.allclose(
              midi.notes,
              [
                  [0.146875, 72.0, 3.32291667, 63.0, 0.0],
                  [1.56666667, 41.0, 0.22291667, 29.0, 0.0],
                  [2.525, 77.0, 0.93020833, 72.0, 0.0],
                  [2.54895833, 60.0, 0.21041667, 28.0, 0.0],
                  [2.5625, 65.0, 0.20208333, 34.0, 0.0],
                  [2.57604167, 56.0, 0.234375, 31.0, 0.0],
                  [3.36875, 75.0, 0.78020833, 64.0, 0.0],
                  [3.44895833, 43.0, 0.271875, 35.0, 0.0],
              ],
          )
      )
      self.assertTrue(
          np.allclose(
              midi.sustained_notes,
              [
                  [0.146875, 72.0, 4.00208333, 63.0, 0.0],
                  [1.56666667, 41.0, 0.22291667, 29.0, 0.0],
                  [2.525, 77.0, 1.62395833, 72.0, 0.0],
                  [2.54895833, 60.0, 0.21041667, 28.0, 0.0],
                  [2.5625, 65.0, 0.20208333, 34.0, 0.0],
                  [2.57604167, 56.0, 0.234375, 31.0, 0.0],
                  [3.36875, 75.0, 0.78020833, 64.0, 0.0],
                  [3.44895833, 43.0, 0.7, 35.0, 0.0],
              ],
          )
      )
  
imports: from __future__ import absolute_import, division, print_function
  import os
  import tempfile
  import unittest
  from os.path import join
  from madmom.io.midi import *
  from .None import ANNOTATIONS_PATH
label_desc: Use image node_id 6 for calling the TestMIDIFileClass obj's underlying member method code with example usage: obj.test_sustain() without return types