This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: doctest's ELLIPSIS and multiline statements
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: boisgerault, tim.peters
Priority: normal Keywords:

Created on 2005-04-29 17:36 by boisgerault, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg25179 - (view) Author: Sébastien Boisgérault (boisgerault) Date: 2005-04-29 17:36
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()

---------------------------------------- 
msg25180 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2005-04-29 17:52
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 '...').
History
Date User Action Args
2022-04-11 14:56:11adminsetgithub: 41924
2005-04-29 17:36:31boisgeraultcreate