Change AlmostOp() to rewrite self.assertAlmostEqual(3, 3.0) to 3 == approx(3.0) instead of round(abs(3 - 3.0), 7) == 0.
Still needs tests. Also currently requires adding from pytest import approx though that can be done with something like isort --add-import 'from pytest import approx' $(git status -s | cut -c4-).
Here's an example diff generated by the new AlmostOp():
Closes #63.
Change
AlmostOp()
to rewriteself.assertAlmostEqual(3, 3.0)
to3 == approx(3.0)
instead ofround(abs(3 - 3.0), 7) == 0
.Still needs tests. Also currently requires adding
from pytest import approx
though that can be done with something likeisort --add-import 'from pytest import approx' $(git status -s | cut -c4-)
.Here's an example diff generated by the new
AlmostOp()
: