[issue30221] Deprecate assertNotAlmostEqual

Serhiy Storchaka report at bugs.python.org
Mon May 1 14:51:57 EDT 2017


Serhiy Storchaka added the comment:

> Any peculiarity that applies to assertNotAlmostEqual also applies to assertAlmostEqual, so I'm not sure how removing one but keeping the other would simplify anything.

There are use cases for assertAlmostEqual(). You can find examples in the CPython tests and in other open sources. Do you have use cases for assertNotAlmostEqual()?

> Furthermore, such symmetry between positive and negative asserts is widespread in the unittest API, so this dual API is quite expected and nothing to be surprised about.

This symmetry is not absolute. There are no asserts opposite to assertRaises(), assertWarns(), assertLogs() and assertCountEqual(), assertMultiLineEqual(), assertSequenceEqual(), etc. Some asserts are not symmetric by its nature. assertNotRaises() would be useless.

> There are 100 results in Google books alone. Are the books wrong (honest question, I did not check)?

Do these books have any use cases for assertNotAlmostEqual() or just enumerate the list of TestCase methods?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30221>
_______________________________________


More information about the Python-bugs-list mailing list