code: def test_list_builder(ctx_factory):
      from pytest import importorskip
  
      importorskip("mako")
  
      context = ctx_factory()
      queue = cl.CommandQueue(context)
  
      from pyopencl.algorithm import ListOfListsBuilder
  
      builder = ListOfListsBuilder(
          context,
          [("mylist", np.int32)],
          """//CL//
              void generate(LIST_ARG_DECL USER_ARG_DECL index_type i)
              {
                  int count = i % 4;
                  for (int j = 0; j < count; ++j)
                  {
                      APPEND_mylist(count);
                  }
              }
              """,
          arg_decls=[],
      )
  
      result, evt = builder(queue, 2000)
  
      inf = result["mylist"]
      assert inf.count == 3000
      assert (inf.lists.get()[-6:] == [1, 2, 2, 3, 3, 3]).all()
  
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 27 for calling a global function with example usage: test_list_builder(ctx_factory) without return types