code: def test_a2f_upscale():
      # Test working type scales with needed range
      info = type_info(np.float32)
      # Test values discovered from stress testing.  The largish value (2**115)
      # overflows to inf after the intercept is subtracted, using float32 as the
      # working precision.  The difference between inf and this value is lost.
      arr = np.array(
          [[info["min"], 2**115, info["max"]]], dtype=np.float32
      )
      slope = np.float32(2**121)
      inter = info["min"]
      str_io = BytesIO()
      # We need to provide mn, mx for function to be able to calculate upcasting
      array_to_file(
          arr,
          str_io,
          np.uint8,
          intercept=inter,
          divslope=slope,
          mn=info["min"],
          mx=info["max"],
      )
      raw = array_from_file(arr.shape, np.uint8, str_io)
      back = apply_read_scaling(raw, slope, inter)
      top = back - arr
      score = np.abs(top / arr)
      assert np.all(score < 10)
  
imports: import bz2
  import functools
  import gzip
  import itertools
  import os
  import tempfile
  import threading
  import time
  import warnings
  from io import BytesIO
  from os.path import exists
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from packaging.version import Version
  from nibabel.testing import assert_allclose_safely, assert_dt_equal, error_warnings, suppress_warnings
  from ..casting import OK_FLOATS, floor_log2, sctypes, shared_range, type_info
  from ..openers import BZ2File, ImageOpener, Opener
  from ..optpkg import optional_package
  from ..tmpdirs import InTemporaryDirectory
  from ..volumeutils import _dt_min_max, _ftype4scaled_finite, _is_compressed_fobj, _write_data, apply_read_scaling, array_from_file, array_to_file, best_write_scale_ftype, better_float_of, fname_ext_ul_case, int_scinter_ftype, make_dt_codes, native_code, rec2dict, seek_tell, shape_zoom_affine, working_type, write_zeros
label_desc: Use image node_id 10 for calling a global function with example usage: test_a2f_upscale() without return types