[ python-Bugs-1192554 ] doctest's ELLIPSIS and multiline statements

SourceForge.net noreply at sourceforge.net
Fri Apr 29 19:52:43 CEST 2005


Bugs item #1192554, was opened at 2005-04-29 13:36
Message generated for change (Comment added) made by tim_one
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1192554&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Sébastien Boisgérault (boisgerault)
Assigned to: Nobody/Anonymous (nobody)
Summary: doctest's ELLIPSIS and multiline statements

Initial Comment:

The doctest ELLPSIS marker (default: "...") may be
confused by the doctest parser with the multiline
statement marker ("..."). 

Example: in the following code, the intent was to accept
any result after "print 42". This is NOT a multiline
statement,
but however the test fails (Expected: nothing, Got: 42).

----------------------------------------
#!/usr/bin/env python

import doctest

def test():
    """
    >>> print 42 #doctest: +ELLIPSIS
    ...
    """

def run():
    "Run the test."
    doctest.testmod()

if __name__ == '__main__':
    run()

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

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

>Comment By: Tim Peters (tim_one)
Date: 2005-04-29 13:52

Message:
Logged In: YES 
user_id=31435

That's true.  doctest has few syntax requirements, but the 
inability to start an expected output block with "..." has 
always been one of them, and is independent of the 
ELLIPSIS gimmick.  I doubt this will change, in part because 
the complications needed to "do something about it" are 
probably pig ugly, in part because it's so rare a desire, and in 
part because there are easy ways to work around it (like 
arranging for the expected output to start with something 
other than '...').

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

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


More information about the Python-bugs-list mailing list