-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
Lines 18 to 27 in e1d36ca
def close_to(x, v, bound, name="value"): | |
assert np.all(np.logical_or(np.abs(x - v) < bound, x == v)), ( | |
name + " out of bounds: " + repr(x) + ", " + repr(v) + ", " + repr(bound) | |
) | |
def close_to_logical(x, v, bound, name="value"): | |
assert np.all(np.logical_or(np.abs(np.bitwise_xor(x, v)) < bound, x == v)), ( | |
name + " out of bounds: " + repr(x) + ", " + repr(v) + ", " + repr(bound) | |
) |
Numpy testing routines already take care of asserting / printing failures nicely. We should just use them: https://numpy.org/doc/stable/reference/routines.testing.html