Skip to content

Use numpy testing utilities instead of custom close_to* #6748

@ricardoV94

Description

@ricardoV94

pymc/tests/checks.py

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions