code: def test_able_casting():
      # Check the able_int_type function guesses numpy out type
      types = sctypes["int"] + sctypes["uint"]
      for in_type in types:
          in_info = np.iinfo(in_type)
          in_mn, in_mx = in_info.min, in_info.max
          A = np.zeros((1,), dtype=in_type)
          for out_type in types:
              out_info = np.iinfo(out_type)
              out_mn, out_mx = out_info.min, out_info.max
              B = np.zeros((1,), dtype=out_type)
              ApBt = (A + B).dtype.type
              able_type = able_int_type([in_mn, in_mx, out_mn, out_mx])
              if able_type is None:
                  assert ApBt == np.float64
                  continue
              # Use str for comparison to avoid int32/64 vs intp comparison
              # failures
              assert np.dtype(ApBt).str == np.dtype(able_type).str
  
file_path: nibabel/nibabel/tests/test_casting.py
imports: import os
  from platform import machine
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from ..casting import CastingError, able_int_type, best_float, float_to_int, floor_log2, int_abs, longdouble_precision_improved, sctypes, shared_range, ulp
  from ..testing import suppress_warnings
label_desc: Use image node_id 7 for calling a global function with example usage: test_able_casting() without return types