class_docstr: ArrowIOTensorTest
class_docstr_tok: ["ArrowIOTensorTest"]
docstr: test_arrow_io_dataset_map_from_py_func
code: def test_arrow_io_dataset_map_py_func(self):
      """test_arrow_io_dataset_map_from_py_func"""
      column = "a"
      dtype = tf.dtypes.int64
      column_dtype = self.get_arrow_type(dtype, False)
      arr = pa.array(list(range(100)), column_dtype)
      table = pa.Table.from_arrays([arr], [column])
      spec = {column: dtype}
  
      with tempfile.NamedTemporaryFile(delete=False) as f:
          with pa.RecordBatchFileWriter(f.name, table.schema) as writer:
              for batch in table.to_batches():
                  writer.write_batch(batch)
  
      def read_table(filename):
          filename = filename.numpy().decode("utf-8")
          reader = pa.RecordBatchFileReader(filename)
          return reader.read_all()
  
      def from_py_func(filename):
          from tensorflow_io.python.ops.arrow_io_tensor_ops import (
              ArrowIOResource,
          )
  
          table_res = ArrowIOResource.from_py_function(
              read_table, [filename]
          )
          tio = tfio.IOTensor.from_arrow(table_res, spec=spec)
          return tio(column).to_tensor()
  
      num_iters = 2
      ds = tf.data.Dataset.from_tensor_slices([f.name, f.name]).map(
          from_py_func
      )
      expected = table[column].to_pylist()
  
      iter_count = 0
      for result in ds:
          npt.assert_array_equal(result, expected)
          iter_count += 1
  
      self.assertEqual(iter_count, num_iters)
      os.unlink(f.name)
  
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 9 for calling the ArrowIOTensorTest obj's underlying member method code with example usage: obj.test_arrow_io_dataset_map_py_func() and returns: reader, tio