python/dist/src/Doc/lib libdoctest.tex,1.61,1.62

Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32322/dist/src/Doc/lib Modified Files: libdoctest.tex Log Message: Added a new NORMALIZE_NUMBERS option, which causes number literals in the expected output to match corresponding number literals in the actual output if their values are equal (to ten digits of precision). Index: libdoctest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdoctest.tex,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- libdoctest.tex 27 Sep 2004 04:08:20 -0000 1.61 +++ libdoctest.tex 28 Sep 2004 04:29:57 -0000 1.62 @@ -581,6 +581,17 @@ \end{datadesc} +\begin{datadesc}{NORMALIZE_NUMBERS} + When specified, number literals in the expected output will match + corresponding number literals in the actual output if their values + are equal (to ten digits of precision). For example, \code{1.1} + will match \code{1.1000000000000001}; and \code{1L} will match + \code{1} and \code{1.0}. Currently, \constant{NORMALIZE_NUMBERS} + can fail to normalize numbers when used in conjunction with + ellipsis. In particular, if an ellipsis marker matches one or + more numbers, then number normalization is not supported. +\end{datadesc} + \begin{datadesc}{COMPARISON_FLAGS} A bitmask or'ing together all the comparison flags above. \end{datadesc} @@ -702,7 +713,7 @@ \versionchanged[Constants \constant{DONT_ACCEPT_BLANKLINE}, \constant{NORMALIZE_WHITESPACE}, \constant{ELLIPSIS}, - \constant{IGNORE_EXCEPTION_DETAIL}, + \constant{IGNORE_EXCEPTION_DETAIL}, \constant{NORMALIZE_NUMBERS}, \constant{REPORT_UDIFF}, \constant{REPORT_CDIFF}, \constant{REPORT_NDIFF}, \constant{REPORT_ONLY_FIRST_FAILURE}, \constant{COMPARISON_FLAGS} and \constant{REPORTING_FLAGS} @@ -740,6 +751,7 @@ % Hey! What happened to Monty Python examples? % Tim: ask Guido -- it's his example! +% doctest: ignore \begin{verbatim}
foo() {"Hermione": "hippogryph", "Harry": "broomstick"} @@ -747,6 +759,7 @@
is vulnerable! One workaround is to do +% doctest: ignore \begin{verbatim}
foo() == {"Hermione": "hippogryph", "Harry": "broomstick"} True @@ -754,6 +767,7 @@
instead. Another is to do +% doctest: ignore \begin{verbatim}
d = foo().items() d.sort() @@ -765,6 +779,7 @@
Another bad idea is to print things that embed an object address, like +% doctest: ignore \begin{verbatim}
id(1.0) # certain to fail some of the time 7948648 @@ -776,6 +791,7 @@ The \constant{ELLIPSIS} directive gives a nice approach for the last example:
C() #doctest: +ELLIPSIS <__main__.C instance at 0x...> @@ -785,6 +801,7 @@
+% doctest: ignore \begin{verbatim} platforms, because Python defers to the platform C library for float formatting, and C libraries vary widely in quality here. +% doctest: ignore \begin{verbatim}
1./7 # risky 0.14285714285714285 @@ -1618,6 +1635,7 @@
Then an interactive Python session may look like this: +% doctest: ignore \begin{verbatim}
import a, doctest doctest.testmod(a)
participants (1)
-
edloper@users.sourceforge.net