code: def test_sort_ranges(self):
      contigs = [
          reference_pb2.ContigInfo(
              name="c", n_bases=100, pos_in_fasta=0
          ),
          reference_pb2.ContigInfo(
              name="a", n_bases=76, pos_in_fasta=1
          ),
          reference_pb2.ContigInfo(
              name="b", n_bases=121, pos_in_fasta=2
          ),
      ]
      unsorted = ranges.parse_literals(
          ["a:10", "c:20", "b:30", "b:10-15", "b:10", "a:5"]
      )
  
      # Without contigs we sort the contigs by name lexicographically.
      self.assertEqual(
          ranges.parse_literals(
              ["a:5", "a:10", "b:10", "b:10-15", "b:30", "c:20"]
          ),
          ranges.sorted_ranges(unsorted),
      )
  
      # With contigs we sort by the position of the contigs themselves.
      self.assertEqual(
          ranges.parse_literals(
              ["c:20", "a:5", "a:10", "b:10", "b:10-15", "b:30"]
          ),
          ranges.sorted_ranges(unsorted, contigs),
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import itertools
  from absl.testing import absltest
  from absl.testing import parameterized
  import mock
  from third_party.nucleus.protos import position_pb2
  from third_party.nucleus.protos import reference_pb2
  from third_party.nucleus.protos import variants_pb2
  from third_party.nucleus.testing import test_utils
  from third_party.nucleus.util import ranges
label_desc: Use image node_id 34 for calling the RangesTests obj's underlying member method code with example usage: obj.test_sort_ranges() without return types