code: def test_noncoerced_nanoseconds_written_without_exception(tempdir):
      # ARROW-1957: the Parquet version 2.0 writer preserves Arrow
      # nanosecond timestamps by default
      n = 9
      df = pd.DataFrame(
          {"x": range(n)},
          index=pd.date_range("2017-01-01", freq="1n", periods=n),
      )
      tb = pa.Table.from_pandas(df)
  
      filename = tempdir / "written.parquet"
      try:
          pq.write_table(tb, filename, version="2.6")
      except Exception:
          pass
      assert filename.exists()
  
      recovered_table = pq.read_table(filename)
      assert tb.equals(recovered_table)
  
      # Loss of data through coercion (without explicit override) still an error
      filename = tempdir / "not_written.parquet"
      with pytest.raises(ValueError):
          pq.write_table(
              tb, filename, coerce_timestamps="ms", version="2.6"
          )
  
file_path: arrow/python/pyarrow/tests/parquet/test_datetime.py
imports: import datetime
  import io
  import warnings
  import numpy
  import pytest
  import pyarrow
  from pyarrow.tests.parquet.common import _check_roundtrip
label_desc: Use image node_id 12 for calling a global function with example usage: test_noncoerced_nanoseconds_written_without_exception(tempdir) without return types