code: def test_shard_sorted_tfrecords(self, filename):
      protos, path = self.write_test_protos(filename)
  
      # Create our generator of records.
      key = lambda x: int(x.name)
      reader = tfrecord.read_shard_sorted_tfrecords(
          path, key=key, proto=reference_pb2.ContigInfo
      )
  
      # Make sure it's actually a generator.
      self.assertEqual(type(reader), types.GeneratorType)
  
      # Check the round-trip contents.
      contents = list(reader)
      self.assertEqual(protos, contents)
      self.assertEqual(contents, sorted(contents, key=key))
  
file_path: deepvariant/third_party/nucleus/io/tfrecord_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import types
  from absl.testing import absltest
  from absl.testing import parameterized
  from third_party.nucleus.io import tfrecord
  from third_party.nucleus.protos import reference_pb2
  from third_party.nucleus.testing import test_utils
label_desc: Use image node_id 4 for calling the IOTest obj's underlying member method code with example usage: obj.test_shard_sorted_tfrecords(filename) without return types