Mark Dickinson added the comment:

The `assertAlmostEqual` comparison looks at the difference between the two 
values, and rounds that to 2 decimal places. In this case, the difference is 
approximately 0.00505, which rounded to 2 decimal places is 0.01.

If instead each of the two values were rounded and the rounded values compared, 
you'd end up in a situation where (for example) `self.assertEqual(1.144999999, 
1.145000001, places=2)` failed, despite the values being only 2 billionths 
apart.

----------
nosy: +mark.dickinson

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30515>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to