code: def test_parquet_file_explicitly_closed(tempdir):
      """
      Unopened files should be closed explicitly after use,
      and previously opened files should be left open.
      Applies to read_table, ParquetDataset, and ParquetFile
      """
      # create test parquet file
      fn = tempdir.joinpath("file.parquet")
      table = pa.table({"col1": [0, 1], "col2": [0, 1]})
      pq.write_table(table, fn)
  
      # ParquetFile with opened file (will leave open)
      with open(fn, "rb") as f:
          with pq.ParquetFile(f) as p:
              p.read()
              assert not f.closed
              assert not p.closed
          assert not f.closed  # opened input file was not closed
          assert not p.closed  # parquet file obj reports as not closed
      assert f.closed
      assert (
          p.closed
      )  # parquet file being closed reflects underlying file
  
      # ParquetFile with unopened file (will close)
      with pq.ParquetFile(fn) as p:
          p.read()
          assert not p.closed
      assert p.closed
  
file_path: arrow/python/pyarrow/tests/parquet/test_parquet_file.py
imports: import io
  import os
  import sys
  import pytest
  import pyarrow
label_desc: Use image node_id 12 for calling a global function with example usage: test_parquet_file_explicitly_closed(tempdir) without return types