code: def test_with_offset_scale():
      # Tests of specific cases in slope, inter
      SIAW = SlopeInterArrayWriter
      aw = SIAW(np.array([0, 127], dtype=np.int8), np.uint8)
      assert (aw.slope, aw.inter) == (1, 0)  # in range
      aw = SIAW(np.array([-1, 126], dtype=np.int8), np.uint8)
      assert (aw.slope, aw.inter) == (1, -1)  # offset only
      aw = SIAW(np.array([-1, 254], dtype=np.int16), np.uint8)
      assert (aw.slope, aw.inter) == (1, -1)  # offset only
      aw = SIAW(np.array([-1, 255], dtype=np.int16), np.uint8)
      assert (aw.slope, aw.inter) != (1, -1)  # Too big for offset only
      aw = SIAW(np.array([-256, -2], dtype=np.int16), np.uint8)
      assert (aw.slope, aw.inter) == (1, -256)  # offset only
      aw = SIAW(np.array([-256, -2], dtype=np.int16), np.int8)
      assert (aw.slope, aw.inter) == (1, -129)
  
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 12 for calling a global function with example usage: test_with_offset_scale() without return types