code: def test_set_gc_state():
      gc_status = gc.isenabled()
      try:
          for state in (True, False):
              gc.enable()
              set_gc_state(state)
              assert_equal(gc.isenabled(), state)
              gc.disable()
              set_gc_state(state)
              assert_equal(gc.isenabled(), state)
      finally:
          if gc_status:
              gc.enable()
  
file_path: scipy/scipy/_lib/tests/test__gcutils.py
imports: import gc
  from scipy._lib._gcutils import set_gc_state, gc_state, assert_deallocated, ReferenceError, IS_PYPY
  from numpy.testing import assert_equal
  import pytest
label_desc: Use image node_id 1 for calling a global function with example usage: test_set_gc_state() without return types