New submission from Jason R. Coombs <jar...@jaraco.com>:

I'm trying to write a doctest that prints the hash and filename of a directory. 
The input is the test dir, but due to the unordered nature of file systems, the 
doctest checks for one known file:

def hash_files(root):
        """
        >>> res = hash_files(Path(__file__).dirname())
        Discovering documents
        Hashing documents
        ...
        >>> print(res)
        ...
        d41d8cd98f00b204e9800998ecf8427e __init__.py
        ...
        """

However, this test fails with:

――――――――――――――――――――――――― [doctest] jaraco.financial.records.hash_files 
――――――――――――――――――――――――――
047 
048     >>> res = hash_files(Path(__file__).dirname())
049     Discovering documents
050     Hashing documents
051     ...
052     >>> print(res)
Expected:
    d41d8cd98f00b204e9800998ecf8427e __init__.py
    ...
Got:
    e1f9390d13c90c7ed601afffd1b9a9f9 records.py
    6a116973e8f29c923a08c2be69b11859 ledger.py
    d41d8cd98f00b204e9800998ecf8427e __init__.py
    b83c8a54d6b71e28ccb556a828e3fa5e qif.py
    ac2d598f65b6debe9888aafe51e9570f ofx.py
    9f2572f761342d38239a1394f4337165 msmoney.py
    <BLANKLINE>



The first ellipsis is interpreted as a degenerate continuation of the input 
line, and it seems it's not possible to have an ellipsis at the beginning of 
the expected input.

Is there any workaround for this issue?

----------
messages: 309599
nosy: jason.coombs
priority: normal
severity: normal
status: open
title: doctest syntax ambiguity between continuation line and ellipsis
type: behavior

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32509>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to