[Python-checkins] python/dist/src/Doc/lib libdoctest.tex,1.63,1.64

edloper at users.sourceforge.net edloper at users.sourceforge.net
Thu Sep 30 19:18:21 CEST 2004


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10177/dist/src/Doc/lib

Modified Files:
	libdoctest.tex 
Log Message:
Added 2 notes about the complexities of testing SyntaxErrors.


Index: libdoctest.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdoctest.tex,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- libdoctest.tex	28 Sep 2004 05:50:57 -0000	1.63
+++ libdoctest.tex	30 Sep 2004 17:18:18 -0000	1.64
@@ -495,6 +495,37 @@
 \item When the \constant{IGNORE_EXCEPTION_DETAIL} doctest option is
   is specified, everything following the leftmost colon is ignored.
 
+\item The interactive shell omits the traceback header line for some
+  \exception{SyntaxError}s.  But doctest uses the traceback header
+  line to distinguish exceptions from non-exceptions.  So in the rare
+  case where you need to test a \exception{SyntaxError} that omits the
+  traceback header, you will need to manually add the traceback header
+  line to your test example.
+  
+\item For some \exception{SyntaxError}s, Python displays the character
+  position of the syntax error, using a \code{\^} marker:
+
+\begin{verbatim}
+>>> 1 1
+  File "<stdin>", line 1
+    1 1
+      ^
+SyntaxError: invalid syntax
+\end{verbatim}
+
+  Since the lines showing the position of the error come before the
+  exception type and detail, they are not checked by doctest.  For
+  example, the following test would pass, even though it puts the
+  \code{\^} marker in the wrong location:
+
+\begin{verbatim}
+>>> 1 1
+  File "<stdin>", line 1
+    1 1
+    ^
+SyntaxError: invalid syntax
+\end{verbatim}
+
 \end{itemize}
 
 \versionchanged[The ability to handle a multi-line exception detail,



More information about the Python-checkins mailing list