code: def assert_allclose_safely(
      a, b, match_nans=True, rtol=1e-5, atol=1e-8
  ):
      """Allclose in integers go all wrong for large integers"""
      a = np.atleast_1d(a)  # 0d arrays cannot be indexed
      a, b = np.broadcast_arrays(a, b)
      if match_nans:
          nans = np.isnan(a)
          assert_array_equal(nans, np.isnan(b))
          to_test = ~nans
      else:
          to_test = np.ones(a.shape, dtype=bool)
      # Deal with float128 inf comparisons (bug in numpy 1.9.2)
      # np.allclose(np.float128(np.inf), np.float128(np.inf)) == False
      to_test = to_test & (a != b)
      a = a[to_test]
      b = b[to_test]
      if a.dtype.kind in "ui":
          a = a.astype(float)
      if b.dtype.kind in "ui":
          b = b.astype(float)
      assert np.allclose(a, b, rtol=rtol, atol=atol)
  
imports: from __future__ import annotations
  import os
  import re
  import sys
  import typing
  import unittest
  import warnings
  from contextlib import nullcontext
  from itertools import zip_longest
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from .helpers import assert_data_similar, bytesio_filemap, bytesio_round_trip
  from .np_features import memmap_after_ufunc
label_desc: Use image node_id 3 for calling a global function with example usage: assert_allclose_safely(a, b, match_nans, rtol, atol) without return types