unittest2pytest
unittest2pytest copied to clipboard
Use `pytest.approx` in `fixes.AlmostOp`
Closes #63.
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()
: