[Python-ideas] float comparison in doctes

Kevin Davies daviesk24 at yahoo.com
Mon Sep 15 21:02:20 CEST 2014


It seems that this didn't reach the list directly (see https://mail.python.org/pipermail/python-ideas/2014-August/028956.html), so I'm resending:

Erik Bray (the author of the +FLOAT_CMP extension in Astropy), Bruce Leban, and I had a short off-thread email discussion. Here are the points: 

- [Bruce]: ALMOST_EQUAL is the best flag name.
- [Erik]: If there's agreement on this, Erik will develop a patch as soon as he can.
- [Erik]: There's no way to adjust the tolerance because there seems to be no easy way to parameterize doctest flags. Ideas are welcome.
- [Erik]: Still, "This +FLOAT_CMP flag enabled removing tons of ellipses from the test outputs [of Astropy], and restoring the full outputs which certainly read better in the docs... For more complete unit tests of course we use assert_almost_equal type functions.
- [Erik]: This PR is a better link than the one I gave: https://github.com/astropy/astropy/pull/2087
- [Erik]: Most of the code is from the SymPy project with improvements. Erik had started on a similar feature when he found that their implementation was further developed.


Kevin



More information about the Python-ideas mailing list