code: def test_avro_kafka_dataset():
      """test_avro_kafka_dataset"""
      import tensorflow_io.kafka as kafka_io
  
      schema = (
          '{"type":"record","name":"myrecord","fields":['
          '{"name":"f1","type":"string"},'
          '{"name":"f2","type":"long"},'
          '{"name":"f3","type":["null","string"],"default":null}'
          "]}"
      )
      dataset = kafka_io.KafkaDataset(
          ["avro-test:0"], group="avro-test", eof=True
      )
      # remove kafka framing
      dataset = dataset.map(lambda e: tf.strings.substr(e, 5, -1))
      # deserialize avro
      dataset = dataset.map(
          lambda e: tfio.experimental.serialization.decode_avro(
              e, schema=schema
          )
      )
      entries = [
          (
              e["f1"].numpy().decode(),
              e["f2"].numpy(),
              e["f3"].numpy().decode(),
          )
          for e in dataset
      ]
      assert np.all(
          entries
          == [("value1", 1, ""), ("value2", 2, "2"), ("value3", 3, "")]
      )
  
imports: import sys
  import time
  import pytest
  import numpy
  import threading
  import tensorflow
  import tensorflow_io
label_desc: Use image node_id 3 for calling a global function with example usage: test_avro_kafka_dataset() without return types