code: def test_avro_partition():
      """test_avro_partition"""
      # The test.bin was created from avro/lang/c++/examples/datafile.cc.
      filename = os.path.join(
          os.path.dirname(os.path.abspath(__file__)),
          "test_avro",
          "test.bin",
      )
      filename = "file://" + filename
  
      schema_filename = os.path.join(
          os.path.dirname(os.path.abspath(__file__)),
          "test_avro",
          "cpx.json",
      )
      with open(schema_filename) as f:
          schema = f.read()
      for _ in [1, 2, 3, 11, 12, 13, 50, 51, 100]:  # capacity
          avro = tfio.IOTensor.from_avro(
              filename, schema
          )  # TODO: enable capacity=capacity
          assert np.all(
              avro("im").to_tensor().numpy()
              == [100.0 + i for i in range(100)]
          )
          assert np.all(
              avro("re").to_tensor().numpy()
              == [100.0 * i for i in range(100)]
          )
          for step in [1, 2, 3, 10, 11, 12, 13, 50, 51, 52, 53]:
              indices = list(range(0, 100, step))
              for start, stop in zip(indices, indices[1:] + [100]):
                  im_expected = [100.0 + i for i in range(start, stop)]
                  im_items = avro("im")[start:stop]
                  assert np.all(im_items.numpy() == im_expected)
  
                  re_expected = [100.0 * i for i in range(start, stop)]
                  re_items = avro("re")[start:stop]
                  assert np.all(re_items.numpy() == re_expected)
  
imports: import os
  import numpy
  import tensorflow
  import tensorflow_io
label_desc: Use image node_id 2 for calling a global function with example usage: test_avro_partition() without return types