code: def test_capsule(capture):
      pytest.gc_collect()
      with capture:
          a = m.return_capsule_with_destructor()
          del a
          pytest.gc_collect()
      assert (
          capture.unordered
          == """
          creating capsule
          destructing capsule
      """
      )
  
      with capture:
          a = m.return_renamed_capsule_with_destructor()
          del a
          pytest.gc_collect()
      assert (
          capture.unordered
          == """
          creating capsule
          renaming capsule
          destructing capsule
      """
      )
  
      with capture:
          a = m.return_capsule_with_destructor_2()
          del a
          pytest.gc_collect()
      assert (
          capture.unordered
          == """
          creating capsule
          destructing capsule: 1234
      """
      )
  
      with capture:
          a = m.return_renamed_capsule_with_destructor_2()
          del a
          pytest.gc_collect()
      assert (
          capture.unordered
          == """
          creating capsule
          renaming capsule
          destructing capsule: 1234
      """
      )
  
      with capture:
          a = m.return_capsule_with_name_and_destructor()
          del a
          pytest.gc_collect()
      assert (
          capture.unordered
          == """
          created capsule (1234, 'pointer type description')
          destructing capsule (1234, 'pointer type description')
      """
      )
  
      with capture:
          a = m.return_capsule_with_explicit_nullptr_dtor()
          del a
          pytest.gc_collect()
      assert (
          capture.unordered
          == """
          creating capsule with explicit nullptr dtor
      """
      )
  
imports: import contextlib
  import sys
  import types
  import pytest
  import env
  from pybind11_tests import detailed_error_messages_enabled
  from pybind11_tests import pytypes
label_desc: Use image node_id 21 for calling a global function with example usage: test_capsule(capture) without return types