A Flake8 plugin to check for the use of round() in assertEqual and assertAlmostEqual.
It detects and flags two issues:
- AAE100 Don't use 'assertAlmostEqual' with 'round'. Use it's implemented rounding.
- AAE110 Don't use 'assertEqual' with 'round'. Use 'assertAlmostEqual' instead.
assertAlmostEqual has built in rounding. Thus round() is not required.
assertAlmostEqual(round(my_result, 2), 1.52)assertAlmostEqual(my_result, 1.52, 2)If you need rounding, don't use assertEqual. Use assertAlmostEqual
instead.
assertEqual(round(my_result, 2), 1.52)assertAlmostEqual(my_result, 1.52, 2)