code: def test_rescaleData():
      rng = np.random.default_rng(12345)
      dtypes = map(
          np.dtype, ("ubyte", "uint16", "byte", "int16", "int", "float")
      )
      for dtype1 in dtypes:
          for dtype2 in dtypes:
              if dtype1.kind in "iu":
                  lim = np.iinfo(dtype1)
                  data = rng.integers(
                      lim.min,
                      lim.max,
                      size=10,
                      dtype=dtype1,
                      endpoint=True,
                  )
              else:
                  data = (
                      rng.random(size=10) * 2**32 - 2**31
                  ).astype(dtype1)
              for scale, offset in [
                  (10, 0),
                  (10.0, 0.0),
                  (1, -50),
                  (0.2, 0.5),
                  (0.001, 0),
              ]:
                  if dtype2.kind in "iu":
                      lim = np.iinfo(dtype2)
                      lim = lim.min, lim.max
                  else:
                      lim = (-np.inf, np.inf)
                  s1 = np.clip(
                      float(scale) * (data - float(offset)), *lim
                  ).astype(dtype2)
                  s2 = pg.rescaleData(data, scale, offset, dtype2)
                  assert s1.dtype == s2.dtype
                  if dtype2.kind in "iu":
                      assert np.all(s1 == s2)
                  else:
                      assert np.allclose(s1, s2)
  
imports: from collections import OrderedDict
  from copy import deepcopy
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal
  import pyqtgraph
  from pyqtgraph.functions import arrayToQPath, eq
  from pyqtgraph.Qt import QtGui
label_desc: Use image node_id 6 for calling a global function with example usage: test_rescaleData() without return types