code: def test_arraywriter_check_scaling():
      # Check keyword-only argument to ArrayWriter
      # Within range - OK
      arr = np.array([0, 1, 128, 255], np.uint8)
      aw = ArrayWriter(arr)
      # Out of range, scaling needed, default is error
      with pytest.raises(WriterError):
          ArrayWriter(arr, np.int8)
      # Make default explicit
      with pytest.raises(WriterError):
          ArrayWriter(arr, np.int8, check_scaling=True)
      # Turn off scaling check
      aw = ArrayWriter(arr, np.int8, check_scaling=False)
      assert_array_equal(round_trip(aw), np.clip(arr, 0, 127))
      # Has to be keyword
      with pytest.raises(TypeError):
          ArrayWriter(arr, np.int8, False)
  
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 3 for calling a global function with example usage: test_arraywriter_check_scaling() without return types