[Python-ideas] PEP 485: A Function for testing approximate equality

Chris Barker chris.barker at noaa.gov
Fri Feb 6 01:11:05 CET 2015


On Thu, Feb 5, 2015 at 2:49 PM, Andrew Barnert <abarnert at yahoo.com> wrote:
>
> >- For unittests are you proposing to replace assertAlmostEquals or
> deprecate that and add a new assertIsCloseTo? (I hope the latter.
> >
>
> >Add an assertIsCloseTo -- whether assertAlmostEquals should be deprecated
> I have no opinion on. Though it is useful, as it acts over a sequence --
> I"m guessing fols will want to keep it.
>
> Why not have assertIsCloseTo act over a sequence in exactly the same way
> as assertAlmostEquals, in which case there's no reason to keep the latter
> (except for existing unit tests that already use it, but presumably a long
> period of deprecation is sufficient there)?
>

Because assertAlmostEquals() is an absolute tolerance test -- not a
relative one -- and it lets (encourages?) users to specify number of
decimal places (or optionally install a explicit absolute tolerance). I
assume this is all there because someone found it useful.

Again, I have little opinion about all this -- I don't like/use unitest
anyway. I"m hoping someone else will take up the mantle of what to do with
unittest...

-Chris



-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150205/f90a8fb3/attachment-0001.html>


More information about the Python-ideas mailing list