code: def test_iter():
      # Check we can iterate over lines, if the underlying file object allows it
      lines = """On the
  blue ridged mountains
  of
  virginia
  """.splitlines()
      with InTemporaryDirectory():
          sobj = BytesIO()
          files_to_test = [
              ("test.txt", True),
              ("test.txt.gz", False),
              ("test.txt.bz2", False),
              (sobj, True),
          ]
          if HAVE_ZSTD:
              files_to_test += [("test.txt.zst", False)]
          for input, does_t in files_to_test:
              with Opener(input, "wb") as fobj:
                  for line in lines:
                      fobj.write(str.encode(line + os.linesep))
              with Opener(input, "rb") as fobj:
                  for back_line, line in zip(fobj, lines):
                      assert back_line.decode().rstrip() == line
              if not does_t:
                  continue
              with Opener(input, "rt") as fobj:
                  for back_line, line in zip(fobj, lines):
                      assert back_line.rstrip() == line
          lobj = Opener(Lunk(""))
          with pytest.raises(TypeError):
              list(lobj)
  
imports: import contextlib
  import hashlib
  import os
  import time
  import unittest
  from gzip import GzipFile
  from io import BytesIO, UnsupportedOperation
  from unittest import mock
  import pytest
  from packaging.version import Version
  from ..deprecator import ExpiredDeprecationError
  from ..openers import HAVE_INDEXED_GZIP, BZ2File, DeterministicGzipFile, ImageOpener, Opener
  from ..optpkg import optional_package
  from ..tmpdirs import InTemporaryDirectory
label_desc: Use image node_id 11 for calling a global function with example usage: test_iter() without return types