[issue35656] More matchers in unittest.mock
Petter S
report at bugs.python.org
Fri Jan 11 03:32:44 EST 2019
Petter S <petter.strandmark at gmail.com> added the comment:
I am of the opposite opinion. :-)
> if I know roughly what the float should be why would I not want to test it for exactness?
When testing algorithms, it is often the case that the answer should be mathematically exactly 2, but due to floating-point inexactness it becomes, say, 1.9999999997 in practice. If I then test for exactly 1.9999999997 the test becomes very brittle and sensitive for e.g. order of multiplications.
Testing floating point numbers with a relative error is essential in many application.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35656>
_______________________________________
More information about the Python-bugs-list
mailing list