code: def test_kafka_group_io_dataset_auto_offset_reset():
      """Test the functionality of the `auto.offset.reset` configuration
      at global and topic level"""
  
      dataset = tfio.experimental.streaming.KafkaGroupIODataset(
          topics=["key-partition-test"],
          group_id="cgglobaloffsetearliest",
          servers="localhost:9092",
          configuration=[
              "session.timeout.ms=7000",
              "max.poll.interval.ms=8000",
              "auto.offset.reset=earliest",
          ],
      )
      assert np.all(
          sorted(k.numpy() for (k, _) in dataset)
          == sorted(("D" + str(i)).encode() for i in range(100))
      )
  
      dataset = tfio.experimental.streaming.KafkaGroupIODataset(
          topics=["key-partition-test"],
          group_id="cgglobaloffsetlatest",
          servers="localhost:9092",
          configuration=[
              "session.timeout.ms=7000",
              "max.poll.interval.ms=8000",
              "auto.offset.reset=latest",
          ],
      )
      assert np.all(sorted(k.numpy() for (k, _) in dataset) == [])
  
      dataset = tfio.experimental.streaming.KafkaGroupIODataset(
          topics=["key-partition-test"],
          group_id="cgtopicoffsetearliest",
          servers="localhost:9092",
          configuration=[
              "session.timeout.ms=7000",
              "max.poll.interval.ms=8000",
              "conf.topic.auto.offset.reset=earliest",
          ],
      )
      assert np.all(
          sorted(k.numpy() for (k, _) in dataset)
          == sorted(("D" + str(i)).encode() for i in range(100))
      )
  
      dataset = tfio.experimental.streaming.KafkaGroupIODataset(
          topics=["key-partition-test"],
          group_id="cgtopicoffsetlatest",
          servers="localhost:9092",
          configuration=[
              "session.timeout.ms=7000",
              "max.poll.interval.ms=8000",
              "conf.topic.auto.offset.reset=latest",
          ],
      )
      assert np.all(sorted(k.numpy() for (k, _) in dataset) == [])
  
imports: import sys
  import time
  import pytest
  import numpy
  import threading
  import tensorflow
  import tensorflow_io
label_desc: Use image node_id 14 for calling a global function with example usage: test_kafka_group_io_dataset_auto_offset_reset() without return types