code: def test_no_scaling():
      # Test arraywriter when writing different types without scaling
      for in_dtype, out_dtype, awt in itertools.product(
          NUMERIC_TYPES,
          NUMERIC_TYPES,
          (ArrayWriter, SlopeArrayWriter, SlopeInterArrayWriter),
      ):
          mn_in, mx_in = _dt_min_max(in_dtype)
          arr = np.array([mn_in, 0, 1, mx_in], dtype=in_dtype)
          kwargs = (
              dict(check_scaling=False)
              if awt == ArrayWriter
              else dict(calc_scale=False)
          )
          aw = awt(arr, out_dtype, **kwargs)
          with suppress_warnings():
              back_arr = round_trip(aw)
          exp_back = arr.copy()
          # If converting to floating point type, casting is direct.
          # Otherwise we will need to do float-(u)int casting at some point.
          if out_dtype in IUINT_TYPES:
              if in_dtype in CFLOAT_TYPES:
                  # Working precision is (at least) float
                  with suppress_warnings():
                      exp_back = exp_back.astype(float)
                  # Float to iu conversion will always round, clip
                  with np.errstate(invalid="ignore"):
                      exp_back = np.round(exp_back)
                  if hasattr(aw, "slope") and in_dtype in FLOAT_TYPES:
                      # Finite scaling sets infs to min / max
                      exp_back = np.clip(exp_back, 0, 1)
                  else:
                      # Clip to shared range of working precision
                      exp_back = np.clip(
                          exp_back, *shared_range(float, out_dtype)
                      )
              else:  # iu input and output type
                  # No scaling, never gets converted to float.
                  # Does get clipped to range of output type
                  mn_out, mx_out = _dt_min_max(out_dtype)
                  if (mn_in, mx_in) != (mn_out, mx_out):
                      # Use smaller of input, output range to avoid np.clip
                      # upcasting the array because of large clip limits.
                      exp_back = np.clip(
                          exp_back,
                          max(mn_in, mn_out),
                          min(mx_in, mx_out),
                      )
          elif in_dtype in COMPLEX_TYPES:
              # always cast to real from complex
              with suppress_warnings():
                  exp_back = exp_back.astype(float)
          exp_back = exp_back.astype(out_dtype)
          # Sometimes working precision is float32 - allow for small differences
          assert_allclose_safely(back_arr, exp_back)
  
imports: import itertools
  from io import BytesIO
  from platform import machine, python_compiler
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from ..arraywriters import ArrayWriter, ScalingError, SlopeArrayWriter, SlopeInterArrayWriter, WriterError, get_slope_inter, make_array_writer
  from ..casting import int_abs, sctypes, shared_range, type_info
  from ..testing import assert_allclose_safely, suppress_warnings
  from ..volumeutils import _dt_min_max, apply_read_scaling, array_from_file
label_desc: Use image node_id 4 for calling a global function with example usage: test_no_scaling() without return types