code: def test_a2f_mn_mx(out_type):
      # Test array to file mn, mx handling
      str_io = BytesIO()
      arr = np.arange(6, dtype=out_type)
      arr_orig = arr.copy()  # safe backup for testing against
      # Basic round trip to warm up
      array_to_file(arr, str_io)
      data_back = array_from_file(arr.shape, out_type, str_io)
      assert_array_equal(arr, data_back)
      # Clip low
      array_to_file(arr, str_io, mn=2)
      data_back = array_from_file(arr.shape, out_type, str_io)
      # arr unchanged
      assert_array_equal(arr, arr_orig)
      # returned value clipped low
      assert_array_equal(data_back, [2, 2, 2, 3, 4, 5])
      # Clip high
      array_to_file(arr, str_io, mx=4)
      data_back = array_from_file(arr.shape, out_type, str_io)
      # arr unchanged
      assert_array_equal(arr, arr_orig)
      # returned value clipped high
      assert_array_equal(data_back, [0, 1, 2, 3, 4, 4])
      # Clip both
      array_to_file(arr, str_io, mn=2, mx=4)
      data_back = array_from_file(arr.shape, out_type, str_io)
      # arr unchanged
      assert_array_equal(arr, arr_orig)
      # returned value clipped high
      assert_array_equal(data_back, [2, 2, 2, 3, 4, 4])
  
file_path: nibabel/nibabel/tests/test_scaling.py
imports: import warnings
  from io import BytesIO
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from ..casting import sctypes, type_info
  from ..testing import suppress_warnings
  from ..volumeutils import apply_read_scaling, array_from_file, array_to_file, finite_range
  from .test_volumeutils import _calculate_scale
label_desc: Use image node_id 3 for calling a global function with example usage: test_a2f_mn_mx(out_type) without return types