class_docstr: ArrowDatasetTest
class_docstr_tok: ["ArrowDatasetTest"]
docstr: Test that an ArrowDataset can be used in tf.function call
code: def test_tf_function(self):
      """Test that an ArrowDataset can be used in tf.function call"""
      import tensorflow_io.arrow as arrow_io
  
      if not tf.version.VERSION.startswith("2."):
          self.skipTest("Test requires TF2.0 for tf.function")
  
      truth_data = TruthData(
          [list(range(10)), [x * 1.1 for x in range(10)]],
          (tf.dtypes.int32, tf.dtypes.float64),
          (tf.TensorShape([]), tf.TensorShape([])),
      )
  
      @tf.function
      def create_arrow_dataset(serialized_batch):
          """Create an arrow dataset from input tensor"""
          dataset = arrow_io.ArrowDataset(
              serialized_batch,
              list(range(len(truth_data.output_types))),
              truth_data.output_types,
              truth_data.output_shapes,
          )
          return dataset
  
      batch = self.make_record_batch(truth_data)
      buf = io.BytesIO()
      writer = pa.RecordBatchFileWriter(buf, batch.schema)
      writer.write_batch(batch)
      writer.close()
  
      for row, results in enumerate(
          create_arrow_dataset(buf.getvalue())
      ):
          value = [result.numpy() for result in results]
          self.assertEqual(value[0], truth_data.data[0][row])
          self.assertAlmostEqual(value[1], truth_data.data[1][row], 4)
  
imports: from collections import namedtuple
  import io
  import os
  import socket
  import tempfile
  import threading
  import pytest
  import pyarrow
  import numpy.testing
  import tensorflow
  import tensorflow_io
label_desc: Use image node_id 18 for calling the ArrowDatasetTest obj's underlying member method code with example usage: obj.test_tf_function() and returns: dataset