[ python-Bugs-1009729 ] Cannot doctest a SyntaxError

SourceForge.net noreply at sourceforge.net
Mon Aug 16 02:20:23 CEST 2004


Bugs item #1009729, was opened at 2004-08-15 19:20
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1009729&group_id=5470

Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Raymond Hettinger (rhettinger)
Assigned to: Edward Loper (edloper)
Summary: Cannot doctest a SyntaxError

Initial Comment:
Currently, doctests cannot be used to demonstrate or
test that misconstructions produce a syntax error.  I'm
not certain, but I believe that case is trappable and
veriable.  

The following is an actual use case for one of the
tests I would like to have in test.test_genexps.py:


Verify that parenthesis are required in a statement
>>> def f(n):
...     return i*i for i in xrange(n)
...
SyntaxError: invalid syntax

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1009729&group_id=5470


More information about the Python-bugs-list mailing list