code: def test_in_memory_sort(self):
      lst = list(range(1024))
      random.shuffle(lst)
      sorter = ExternalSorter(1024)
      self.assertEqual(sorted(lst), list(sorter.sorted(lst)))
      self.assertEqual(
          sorted(lst, reverse=True),
          list(sorter.sorted(lst, reverse=True)),
      )
      self.assertEqual(
          sorted(lst, key=lambda x: -x),
          list(sorter.sorted(lst, key=lambda x: -x)),
      )
      self.assertEqual(
          sorted(lst, key=lambda x: -x, reverse=True),
          list(sorter.sorted(lst, key=lambda x: -x, reverse=True)),
      )
  
imports: import random
  import unittest
  import tempfile
  import os
  from py4j.protocol import Py4JJavaError
  from pyspark import shuffle, CPickleSerializer, SparkConf, SparkContext
  from pyspark.shuffle import Aggregator, ExternalMerger, ExternalSorter, SimpleAggregator, Merger, ExternalGroupBy
label_desc: Use image node_id 1 for calling the SorterTests obj's underlying member method code with example usage: obj.test_in_memory_sort() without return types