Skip to content

Use numpy testing utilities instead of custom close_to* #6748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ricardoV94 opened this issue Jun 1, 2023 · 2 comments · Fixed by #6961
Closed

Use numpy testing utilities instead of custom close_to* #6748

ricardoV94 opened this issue Jun 1, 2023 · 2 comments · Fixed by #6961

Comments

@ricardoV94
Copy link
Member

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

@error9098x
Copy link
Contributor

Hi, I have changed the testing utility to numpy, now how do I test my changes locally ?

@ricardoV94
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants