code: def test_avro():
      """test_avro"""
      # 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()
  
      avro = tfio.IOTensor.from_avro(filename, schema)
      assert avro("im").dtype == tf.float64
      assert avro("im").shape == [100]
      assert avro("re").dtype == tf.float64
      assert avro("re").shape == [100]
  
      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)]
      )
  
      re_dataset = tfio.IODataset.from_avro(filename, schema, ["re"])
      i = 0
      for v in re_dataset:
          re = v
          assert re.numpy() == 100.0 * i
          i += 1
      assert i == 100
  
      im_dataset = tfio.IODataset.from_avro(filename, schema, ["im"])
      i = 0
      for v in im_dataset:
          im = v
          assert im.numpy() == 100.0 + i
          i += 1
      assert i == 100
  
      dataset = tfio.IODataset.from_avro(filename, schema)
      i = 0
      for v in dataset:
          re, im = v
          assert re.numpy() == 100.0 * i
          assert im.numpy() == 100.0 + i
          i += 1
      assert i == 100
  
imports: import os
  import numpy
  import tensorflow
  import tensorflow_io
label_desc: Use image node_id 1 for calling a global function with example usage: test_avro() without return types