def assert_fp_equal(x, y, err_msg="", nulp=50):
    try:
        assert_array_almost_equal_nulp(x, y, nulp)
    except AssertionError as e:
        raise AssertionError("%s\n%s" % (e, err_msg))
Assert two arrays are equal, up to some floating-point rounding error
dataset/ETHPy150Open scipy/scipy/scipy/optimize/tests/test_linesearch.py/assert_fp_equal