code: def test_haar():
      image = luispedro_jpg(1)
      image = image[:256, :256]
      wav = mahotas.haar(image)
  
      assert wav.shape == image.shape
      assert np.allclose(
          (
              image[0].reshape((-1, 2)).mean(1)
              + image[1].reshape((-1, 2)).mean(1)
          )
          / 2,
          wav[0, :128] / 2.0,
      )
      assert np.abs(np.mean(image**2) - np.mean(wav**2)) < 1.0
  
      image = luispedro_jpg(1)
      wav = mahotas.haar(image, preserve_energy=False)
      assert np.abs(np.mean(image**2) - np.mean(wav**2)) > 16.0
      wav = mahotas.haar(image, inline=True)
      assert id(image) == id(wav)
  
imports: import numpy
  import mahotas
  import mahotas.convolve
  import mahotas
  from mahotas.convolve import convolve1d, gaussian_filter
  import mahotas._filters
  from mahotas.tests.utils import luispedro_jpg
  import pytest
label_desc: Use image node_id 9 for calling a global function with example usage: test_haar() without return types