code: def test_allocator(ctx_factory, allocator_cls):
      context = ctx_factory()
      queue = cl.CommandQueue(context)
  
      if allocator_cls is DeferredAllocator:
          allocator = allocator_cls(context)
      else:
          allocator = allocator_cls(queue)
  
      mem = allocator(15)
      mem2 = allocator(0)
  
      assert mem is not None
      assert mem2 is None
  
imports: import numpy
  import numpy.linalg
  import pytest
  import pyopencl
  import pyopencl.array
  import pyopencl.cltypes
  import pyopencl.clrandom
  from pyopencl.tools import pytest_generate_tests_for_pyopencl, ImmediateAllocator, DeferredAllocator
  from pyopencl.characterize import get_pocl_version
label_desc: Use image node_id 16 for calling a global function with example usage: test_allocator(ctx_factory, allocator_cls) without return types