code: def test_working_type():
      # Which type do input types with slope and inter cast to in numpy?
      # Wrapper function because we need to use the dtype str for comparison.  We
      # need this because of the very confusing np.int32 != np.intp (on 32 bit).
      def wt(*args, **kwargs):
          return np.dtype(working_type(*args, **kwargs)).str
  
      d1 = np.atleast_1d
      for in_type in NUMERIC_TYPES:
          in_ts = np.dtype(in_type).str
          assert wt(in_type) == in_ts
          assert wt(in_type, 1, 0) == in_ts
          assert wt(in_type, 1.0, 0.0) == in_ts
          in_val = d1(in_type(0))
          for slope_type in NUMERIC_TYPES:
              sl_val = slope_type(1)  # no scaling, regardless of type
              assert wt(in_type, sl_val, 0.0) == in_ts
              sl_val = slope_type(2)  # actual scaling
              out_val = in_val / d1(sl_val)
              assert wt(in_type, sl_val) == out_val.dtype.str
              for inter_type in NUMERIC_TYPES:
                  i_val = inter_type(
                      0
                  )  # no scaling, regardless of type
                  assert wt(in_type, 1, i_val) == in_ts
                  i_val = inter_type(1)  # actual scaling
                  out_val = in_val - d1(i_val)
                  assert wt(in_type, 1, i_val) == out_val.dtype.str
                  # Combine scaling and intercept
                  out_val = (in_val - d1(i_val)) / d1(sl_val)
                  assert wt(in_type, sl_val, i_val) == out_val.dtype.str
      # Confirm that type codes and dtypes work as well
      f32s = np.dtype(np.float32).str
      assert wt("f4", 1, 0) == f32s
      assert wt(np.dtype("f4"), 1, 0) == f32s
  
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 30 for calling a global function with example usage: test_working_type() and returns: np