code: def test_as_labeled():
      from mahotas.labeled import _as_labeled
  
      arr = np.zeros((64, 64))
      labeled = np.zeros((64, 64), dtype=np.intc)
      funcname = "testing"
  
      assert (
          _as_labeled(arr, labeled, funcname, inplace=True) is labeled
      )
      assert _as_labeled(arr, labeled, funcname) is labeled
  
      lab2 = _as_labeled(arr, labeled, funcname, inplace=False)
      assert lab2 is not labeled
      assert np.all(labeled == lab2)
  
      assert (
          _as_labeled(arr[::2], labeled[::2], funcname, inplace=False)
          is not labeled
      )
      assert (
          _as_labeled(arr[::2], labeled[::2], funcname, inplace=None)
          is not labeled
      )
      assert (
          _as_labeled(arr[::2], labeled[::2], funcname) is not labeled
      )
  
      with raises(ValueError):
          _as_labeled(arr[::2], labeled[::2], funcname, inplace=True)
  
      with raises(ValueError):
          _as_labeled(arr[::2], labeled, funcname)
  
imports: import numpy
  import mahotas
  import mahotas.labeled
  from pytest import raises
label_desc: Use image node_id 22 for calling a global function with example usage: test_as_labeled() without return types