code: def test_categorical_order_survives_roundtrip():
      # ARROW-6302
      df = pd.DataFrame(
          {
              "a": pd.Categorical(
                  ["a", "b", "c", "a"],
                  categories=["b", "c", "d"],
                  ordered=True,
              )
          }
      )
  
      table = pa.Table.from_pandas(df)
      bos = pa.BufferOutputStream()
      pq.write_table(table, bos)
  
      contents = bos.getvalue()
      result = pq.read_pandas(contents).to_pandas()
  
      tm.assert_frame_equal(result, df)
  
imports: import io
  import json
  import numpy
  import pytest
  import pyarrow
  from pyarrow.fs import LocalFileSystem, SubTreeFileSystem
  from pyarrow.util import guid
  from pyarrow.vendored.version import Version
label_desc: Use image node_id 19 for calling a global function with example usage: test_categorical_order_survives_roundtrip() without return types