[Python-ideas] PEP 485: A Function for testing approximate equality
chris.barker at noaa.gov
Fri Jan 23 18:55:31 CET 2015
On Fri, Jan 23, 2015 at 9:45 AM, Chris Angelico <rosuav at gmail.com> wrote:
> > And the unitest is very vested in
> > it's OO structure -- would we want add free-form functions to it?
> Updating the assertion to use the new function would be a matter of
> tweaking the implementation of unittest's assertAlmostEqual() to now
> call this function and assert that it returns True.
sure -- that's not quite what I meant. I was really addressing the "where
would this sit" question.
unittest does not currently have any stand-alone utility functions for
testing in it. If we put this there, would anyone think to look for it
> I'd say that's a point worth mentioning in the
well, whether to change a TestCase assertion or add a new one is a brand
new question -- we could add that to this PEP if people think that's a good
idea. For my part, I find unittest painful, and use py.test (and sometimes
> it would be worth adding a word or two of docs to unittest stating
> that assertAlmostEqual is not the same as is_close_to (and/or add
> "assertCloseTo" which would use it), as the existing implementation is
> all about absolute difference.
probably a good idea, yes.
I really don't think we want to change assertAlmostEqual -- certainly not
anytime soon. It seems like gratuitous backward incompatibility.
Christopher Barker, Ph.D.
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...
More information about the Python-ideas