code: def test_percentile(internal_method):
      d = da.ones((16,), chunks=(4,))
      qs = [0, 50, 100]
  
      assert_eq(
          da.percentile(d, qs, internal_method=internal_method),
          np.array([1, 1, 1], dtype=d.dtype),
      )
  
      x = np.array([0, 0, 5, 5, 5, 5, 20, 20])
      d = da.from_array(x, chunks=(3,))
  
      result = da.percentile(d, qs, internal_method=internal_method)
      assert_eq(result, np.array([0, 5, 20], dtype=result.dtype))
  
      assert same_keys(
          da.percentile(d, qs, internal_method=internal_method),
          da.percentile(d, qs, internal_method=internal_method),
      )
      assert not same_keys(
          da.percentile(d, qs, internal_method=internal_method),
          da.percentile(d, [0, 50], internal_method=internal_method),
      )
  
      if internal_method != "tdigest":
          x = np.array(["a", "a", "d", "d", "d", "e"])
          d = da.from_array(x, chunks=(3,))
          assert_eq(
              da.percentile(d, [0, 50, 100]),
              np.array(["a", "d", "e"], dtype=x.dtype),
          )
  
file_path: dask/dask/array/tests/test_percentiles.py
imports: from __future__ import annotations
  import pytest
  import numpy
  import dask.array
  from dask.array.utils import assert_eq, same_keys
label_desc: Use image node_id 1 for calling a global function with example usage: test_percentile(internal_method) without return types