code: def test_num_peaks(self):
      image = np.zeros((7, 7), dtype=np.uint8)
      image[1, 1] = 10
      image[1, 3] = 11
      image[1, 5] = 12
      image[3, 5] = 8
      image[5, 3] = 7
      assert (
          len(
              peak.peak_local_max(
                  image, min_distance=1, threshold_abs=0
              )
          )
          == 5
      )
      peaks_limited = peak.peak_local_max(
          image, min_distance=1, threshold_abs=0, num_peaks=2
      )
      assert len(peaks_limited) == 2
      assert (1, 3) in peaks_limited
      assert (1, 5) in peaks_limited
      peaks_limited = peak.peak_local_max(
          image, min_distance=1, threshold_abs=0, num_peaks=4
      )
      assert len(peaks_limited) == 4
      assert (1, 3) in peaks_limited
      assert (1, 5) in peaks_limited
      assert (1, 1) in peaks_limited
      assert (3, 5) in peaks_limited
  
imports: import itertools
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal, assert_equal
  from scipy import ndimage
  from skimage._shared._warnings import expected_warnings
  from skimage.feature import peak
label_desc: Use image node_id 8 for calling the TestPeakLocalMax obj's underlying member method code with example usage: obj.test_num_peaks() without return types