diff options
author | Raymond Hettinger <python@rcn.com> | 2002-12-29 17:59:24 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2002-12-29 17:59:24 (GMT) |
commit | c7b076928c8d3316f6426a49c9d33ce14c0eaaee (patch) | |
tree | cc48c7819d78b3952db20fe0cf805f773a4b8602 /Doc | |
parent | 3c736f1a415fd87fece57756a836f5e06ff2af73 (diff) | |
download | cpython-c7b076928c8d3316f6426a49c9d33ce14c0eaaee.zip cpython-c7b076928c8d3316f6426a49c9d33ce14c0eaaee.tar.gz cpython-c7b076928c8d3316f6426a49c9d33ce14c0eaaee.tar.bz2 |
Incorporate Skip's suggestion to use SciPy's validation test near
equality. Note, there is another flavor that compares to a given
number of significant digits rather than decimal places. If there
is a demand, that could be added at a later date.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libunittest.tex | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Doc/lib/libunittest.tex b/Doc/lib/libunittest.tex index b1c0918..2d710e8 100644 --- a/Doc/lib/libunittest.tex +++ b/Doc/lib/libunittest.tex @@ -501,6 +501,30 @@ report failures. \var{second}. \end{methoddesc} +\begin{methoddesc}[TestCase]{assertAlmostEqual}{first, second\optional{, + places\optional{, msg}}} +\methodline{failUnlessAlmostEqual}{first, second\optional{, + places\optional{, msg}}} + Test that \var{first} and \var{second} are approximately equal + by computing the difference, rounding to the given number of \var{places}, + and comparing to zero. Note that comparing a given number of decimal places + is not the same as comparing a given number of significant digits. + If the values do not compare equal, the test will fail with the explanation + given by \var{msg}, or \code{None}. +\end{methoddesc} + +\begin{methoddesc}[TestCase]{assertNotAlmostEqual}{first, second\optional{, + places\optional{, msg}}} +\methodline{failIfAlmostEqual}{first, second\optional{, + places\optional{, msg}}} + Test that \var{first} and \var{second} are not approximately equal + by computing the difference, rounding to the given number of \var{places}, + and comparing to zero. Note that comparing a given number of decimal places + is not the same as comparing a given number of significant digits. + If the values do not compare equal, the test will fail with the explanation + given by \var{msg}, or \code{None}. +\end{methoddesc} + \begin{methoddesc}[TestCase]{assertRaises}{exception, callable, \moreargs} \methodline{failUnlessRaises}{exception, callable, \moreargs} Test that an exception is raised when \var{callable} is called with |