code: def test_sort_events(self):
      events = sorted([self.e1, self.e2, self.e3, self.e4])
      self.assertTrue(events == [self.e1, self.e3, self.e4, self.e2])
      # MIDITrack should sort the events before writing the MIDI file
      track = MIDITrack([self.e1, self.e2, self.e3, self.e4])
      midi = MIDIFile(track)
      midi.write(tmp_file)
      events = MIDIFile.from_file(tmp_file).tracks[0].events
      self.assertTrue(events == [self.e1, self.e3, self.e4, self.e2])
  
imports: from __future__ import absolute_import, division, print_function
  import os
  import tempfile
  import unittest
  from os.path import join
  from madmom.utils.midi import *
  from .None import ANNOTATIONS_PATH
label_desc: Use image node_id 4 for calling the TestEventsClass obj's underlying member method code with example usage: obj.test_sort_events() without return types