code: def test_searchsorted_execution(setup):
      raw = np.sort(np.random.randint(100, size=(16,)))
  
      # test different chunk_size, 3 will have combine, 6 will skip combine
      for chunk_size in (3, 8):
          arr = tensor(raw, chunk_size=chunk_size)
  
          # test scalar, with value in the middle
          t1 = searchsorted(arr, 20)
  
          res = t1.execute().fetch()
          expected = np.searchsorted(raw, 20)
          np.testing.assert_array_equal(res, expected)
  
          # test scalar, with value larger than 100
          t2 = searchsorted(arr, 200)
  
          res = t2.execute().fetch()
          expected = np.searchsorted(raw, 200)
          np.testing.assert_array_equal(res, expected)
  
          # test scalar, side left, with value exact in the middle of the array
          t3 = searchsorted(arr, raw[10], side="left")
  
          res = t3.execute().fetch()
          expected = np.searchsorted(raw, raw[10], side="left")
          np.testing.assert_array_equal(res, expected)
  
          # test scalar, side right, with value exact in the middle of the array
          t4 = searchsorted(arr, raw[10], side="right")
  
          res = t4.execute().fetch()
          expected = np.searchsorted(raw, raw[10], side="right")
          np.testing.assert_array_equal(res, expected)
  
          # test scalar, side left, with value exact in the end of the array
          t5 = searchsorted(arr, raw[15], side="left")
  
          res = t5.execute().fetch()
          expected = np.searchsorted(raw, raw[15], side="left")
          np.testing.assert_array_equal(res, expected)
  
          # test scalar, side right, with value exact in the end of the array
          t6 = searchsorted(arr, raw[15], side="right")
  
          res = t6.execute().fetch()
          expected = np.searchsorted(raw, raw[15], side="right")
          np.testing.assert_array_equal(res, expected)
  
          # test scalar, side left, with value exact in the start of the array
          t7 = searchsorted(arr, raw[0], side="left")
  
          res = t7.execute().fetch()
          expected = np.searchsorted(raw, raw[0], side="left")
          np.testing.assert_array_equal(res, expected)
  
          # test scalar, side right, with value exact in the start of the array
          t8 = searchsorted(arr, raw[0], side="right")
  
          res = t8.execute().fetch()
          expected = np.searchsorted(raw, raw[0], side="right")
          np.testing.assert_array_equal(res, expected)
  
          raw2 = np.random.randint(100, size=(3, 4))
  
          # test tensor, side left
          t9 = searchsorted(
              arr, tensor(raw2, chunk_size=2), side="left"
          )
  
          res = t9.execute().fetch()
          expected = np.searchsorted(raw, raw2, side="left")
          np.testing.assert_array_equal(res, expected)
  
          # test tensor, side right
          t10 = searchsorted(
              arr, tensor(raw2, chunk_size=2), side="right"
          )
  
          res = t10.execute().fetch()
          expected = np.searchsorted(raw, raw2, side="right")
          np.testing.assert_array_equal(res, expected)
  
      # test one chunk
      arr = tensor(raw, chunk_size=16)
  
      # test scalar, tensor to search has 1 chunk
      t11 = searchsorted(arr, 20)
      res = t11.execute().fetch()
      expected = np.searchsorted(raw, 20)
      np.testing.assert_array_equal(res, expected)
  
      # test tensor with 1 chunk, tensor to search has 1 chunk
      t12 = searchsorted(arr, tensor(raw2, chunk_size=4))
  
      res = t12.execute().fetch()
      expected = np.searchsorted(raw, raw2)
      np.testing.assert_array_equal(res, expected)
  
      # test tensor with more than 1 chunk, tensor to search has 1 chunk
      t13 = searchsorted(arr, tensor(raw2, chunk_size=2))
  
      res = t13.execute().fetch()
      expected = np.searchsorted(raw, raw2)
      np.testing.assert_array_equal(res, expected)
  
      # test sorter
      raw3 = np.random.randint(100, size=(16,))
      arr = tensor(raw3, chunk_size=3)
      order = np.argsort(raw3)
      order_arr = tensor(order, chunk_size=4)
  
      t14 = searchsorted(arr, 20, sorter=order_arr)
  
      res = t14.execute().fetch()
      expected = np.searchsorted(raw3, 20, sorter=order)
      np.testing.assert_array_equal(res, expected)
  
      # all data same
      raw4 = np.ones(8)
      arr = tensor(raw4, chunk_size=2)
  
      for val in (0, 1, 2):
          for side in ("left", "right"):
              t15 = searchsorted(arr, val, side=side)
  
              res = t15.execute().fetch()
              expected = np.searchsorted(raw4, val, side=side)
              np.testing.assert_array_equal(res, expected)
  
imports: import numpy
  import scipy.sparse
  import pandas
  import pytest
  from ....None import dataframe
  from ....None import tensor
  from ....None import execute, fetch
  from ....tests.core import require_cupy
  from ...datasource import tensor, ones, zeros, arange
  from ..None import copyto, transpose, moveaxis, broadcast_to, broadcast_arrays, where, expand_dims, rollaxis, atleast_1d, atleast_2d, atleast_3d, argwhere, array_split, split, hsplit, vsplit, dsplit, roll, squeeze, diff, ediff1d, flip, flipud, fliplr, repeat, tile, isin, searchsorted, unique, sort, argsort, partition, argpartition, topk, argtopk, trapz, shape, to_gpu, to_cpu, swapaxes
label_desc: Use image node_id 28 for calling a global function with example usage: test_searchsorted_execution(setup) without return types