code: def test_parquet_writer_context_obj_with_exception(tempdir):
      df = _test_dataframe(100)
      df["unique_id"] = 0
  
      arrow_table = pa.Table.from_pandas(df, preserve_index=False)
      out = pa.BufferOutputStream()
      error_text = "Artificial Error"
  
      try:
          with pq.ParquetWriter(
              out, arrow_table.schema, version="2.6"
          ) as writer:
              frames = []
              for i in range(10):
                  df["unique_id"] = i
                  arrow_table = pa.Table.from_pandas(
                      df, preserve_index=False
                  )
                  writer.write_table(arrow_table)
                  frames.append(df.copy())
                  if i == 5:
                      raise ValueError(error_text)
      except Exception as e:
          assert str(e) == error_text
  
      buf = out.getvalue()
      result = _read_table(pa.BufferReader(buf))
  
      expected = pd.concat(frames, ignore_index=True)
      tm.assert_frame_equal(result.to_pandas(), expected)
  
file_path: arrow/python/pyarrow/tests/parquet/test_parquet_writer.py
imports: import pytest
  import pyarrow
  from pyarrow import fs
  from pyarrow.filesystem import FileSystem, LocalFileSystem
label_desc: Use image node_id 5 for calling a global function with example usage: test_parquet_writer_context_obj_with_exception(tempdir) without return types