code: def test_parquet_writer_write():
      output = pa.BufferOutputStream()
      with ParquetWriter(stream=output) as writer:
          writer.write({"col_1": "foo", "col_2": 1})
          writer.write({"col_1": "bar", "col_2": 2})
          num_examples, num_bytes = writer.finalize()
      assert num_examples == 2
      assert num_bytes > 0
      stream = pa.BufferReader(output.getvalue())
      pa_table: pa.Table = pq.read_table(stream)
      assert pa_table.to_pydict() == {
          "col_1": ["foo", "bar"],
          "col_2": [1, 2],
      }
  
imports: import copy
  import os
  import tempfile
  from unittest import TestCase
  from unittest.mock import patch
  import numpy
  import pyarrow
  import pyarrow.parquet
  import pytest
  from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence
  from datasets.features import Array2D, ClassLabel, Features, Image, Value
  from datasets.features.features import Array2DExtensionType, cast_to_python_objects
  from datasets.keyhash import DuplicatedKeysError, InvalidKeyError
  from .utils import require_pil
label_desc: Use image node_id 17 for calling a global function with example usage: test_parquet_writer_write() without return types