code: def test_where():
      rng = np.random.default_rng()
      # Copied and adapted from the da.where test.
      x = rng.integers(10, size=(15, 14))
      mask = rng.choice(a=[False, True], size=(15, 14), p=[0.5, 0.5])
      x[5, 5] = x[4, 4] = 0  # Ensure some false elements
      d = da.ma.masked_array(x, mask=mask, chunks=(4, 5))
      x = np.ma.array(x, mask=mask)
      y = rng.integers(10, size=15).astype(np.uint8)
      e = da.from_array(y, chunks=(4,))
  
      # Nonzero test
      sol = np.ma.where(x)
      res = da.ma.where(d)
      for i in range(len(sol)):
          assert_eq(res[i], sol[i])
  
      for c1, c2 in [
          (d > 5, x > 5),
          (d, x),
          (1, 1),
          (5, 5),
          (True, True),
          (np.True_, np.True_),
          (0, 0),
          (False, False),
          (np.False_, np.False_),
      ]:
          for b1, b2 in [
              (0, 0),
              (-e[:, None], -y[:, None]),
              (e[:14], y[:14]),
          ]:
              w1 = da.ma.where(c1, d, b1)
              w2 = np.ma.where(c2, x, b2)
              assert_eq(w1, w2)
  
imports: from __future__ import annotations
  import random
  import sys
  from copy import deepcopy
  from itertools import product
  import numpy
  import pytest
  import dask.array
  from dask.array.numpy_compat import ComplexWarning, _numpy_123
  from dask.array.utils import assert_eq
  from dask.base import tokenize
  from dask.utils import typename
label_desc: Use image node_id 24 for calling a global function with example usage: test_where() without return types