code: def test_index_preservation(ctx_factory):
      from pytest import importorskip
  
      importorskip("mako")
  
      context = ctx_factory()
      queue = cl.CommandQueue(context)
  
      classes = [GenericScanKernel]
  
      dev = context.devices[0]
      if dev.type & cl.device_type.CPU:
          classes.append(GenericDebugScanKernel)
  
      for cls in classes:
          for n in scan_test_counts:
              knl = cls(
                  context,
                  np.int32,
                  arguments="__global int *out",
                  input_expr="i",
                  scan_expr="b",
                  neutral="0",
                  output_statement="""
                          out[i] = item;
                          """,
              )
  
              out = cl.array.empty(queue, n, dtype=np.int32)
              knl(out)
  
              assert (out.get() == np.arange(n)).all()
              from gc import collect
  
              collect()
  
imports: import numpy
  import numpy.linalg
  import sys
  from pytools import memoize
  from test_array import general_clrand
  import pytest
  import pyopencl
  import pyopencl.array
  from pyopencl.tools import pytest_generate_tests_for_pyopencl
  from pyopencl.characterize import has_double_support, has_struct_arg_count_bug
  from pyopencl.scan import InclusiveScanKernel, ExclusiveScanKernel, GenericScanKernel, GenericDebugScanKernel
  from pyopencl.characterize import get_pocl_version
label_desc: Use image node_id 24 for calling a global function with example usage: test_index_preservation(ctx_factory) without return types