fix: replace fragile float == comparisons with pytest.approx in tests#56
Conversation
|
Hello! Thanks for your interest in contributing to the package. As you can see some of the CI checks fail due to ruff compliance issues. If you look at the contributing page you will see our recommended path to auditing your code before submission. We recommend using uv/just for development work. There are a number of very helpful just recipes including |
jc-macdonald
left a comment
There was a problem hiding this comment.
please run ruff checks and fix issues. Thanks for contributing!
|
Thanks, I checked this again locally. The files touched by this PR pass \All checks passed!, and I also ran a targeted pytest subset after installing the dev environment: \ (85 passed, 9 deselected). The repo still has unrelated pre-existing Ruff violations outside this PR, which is probably what CI was surfacing earlier. |
|
Thanks for the follow-up! The CI failure was actually a formatting issue — our CI runs I've merged |
There was a problem hiding this comment.
there were a few missed == fixes, some were added back by upstream. all are now fixed. Closes #33
Fixes #33
Replaces bare float equality/inequality comparisons in tests with
pytest.approxwhere the values come from computations, and adds comments for exact-by-construction comparisons.Changes:
assert x == 0.1→assert x == pytest.approx(0.1)for computed valuesassert x == 0.0→assert x == pytest.approx(0.0)for array element checks!=comparisons where values are exact-by-construction (zero-fill, eps replacement) with explanatory commentsRUF069suppression frompyproject.tomlAll 345 tests pass (1 pre-existing skip due to missing matplotlib).