code: def test_relabel():
      np.random.seed(24)
      for i in range(8):
          f = np.random.random_sample((128, 128)) > 0.8
          labeled, n = mahotas.labeled.label(f)
          labeled *= (labeled % 7) != 4
          relabeled, new_n = mahotas.labeled.relabel(labeled)
          assert relabeled.max() == new_n
          assert (relabeled.max() + 1) == _nelems(labeled)
          assert np.all((relabeled > 0) == (labeled > 0))
          assert not np.all(labeled == relabeled)
  
          for a in (8, 23, 35, 13, 213):
              assert _nelems(labeled[relabeled == a]) == 1
              assert _nelems(relabeled[labeled == a]) == 1
          mahotas.labeled.relabel(labeled, inplace=True)
          assert np.all(labeled == relabeled)
  
imports: import numpy
  import mahotas
  import mahotas.labeled
  from pytest import raises
label_desc: Use image node_id 16 for calling a global function with example usage: test_relabel() without return types