code: def test_roundtrip_schema_capsule(obj):
      gc.collect()  # Make sure no Arrow data dangles in a ref cycle
      old_allocated = pa.total_allocated_bytes()
  
      capsule = obj.__arrow_c_schema__()
      assert PyCapsule_IsValid(capsule, b"arrow_schema") == 1
      assert pa.total_allocated_bytes() > old_allocated
      obj_out = type(obj)._import_from_c_capsule(capsule)
      assert obj_out == obj
  
      assert pa.total_allocated_bytes() == old_allocated
  
      capsule = obj.__arrow_c_schema__()
  
      assert pa.total_allocated_bytes() > old_allocated
      del capsule
      assert pa.total_allocated_bytes() == old_allocated
  
imports: import contextlib
  import ctypes
  import gc
  import pyarrow
  import pytest
label_desc: Use image node_id 26 for calling a global function with example usage: test_roundtrip_schema_capsule(obj) without return types