code: def test_read_text():
      """test_read_text"""
      filename = os.path.join(
          os.path.dirname(os.path.abspath(__file__)),
          "test_text",
          "lorem.txt",
      )
      with open(filename, "rb") as f:
          lines = list(f)
      filename = "file://" + filename
  
      filesize = tf.io.gfile.GFile(filename).size()
  
      offset = 0
      offsets = []
      for line in lines:
          offsets.append(offset)
          offset += len(line)
  
      lines = list(zip(offsets, lines))
  
      for offset, length in [
          (0, -1),
          (1, -1),
          (1000, -1),
          (100, 1000),
          (1000, 10000),
      ]:
          entries = tfio.experimental.text.read_text(
              filename, offset=offset, length=length
          )
          if length < 0:
              length = filesize - offset
          expected = [
              line
              for (k, line) in lines
              if offset <= k < offset + length
          ]
          assert entries.shape == len(expected)
          for k, v in enumerate(expected):
              assert entries[k].numpy().decode() + "\n" == v.decode()
  
file_path: io/tests/test_text.py
imports: import os
  import re
  import tempfile
  import pytest
  import numpy
  import tensorflow
  import tensorflow_io
label_desc: Use image node_id 1 for calling a global function with example usage: test_read_text() without return types