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.

Author jaraco
Recipients jaraco
Date 2018-01-07.04:05:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1515297917.31.0.467229070634.issue32509@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2018-01-07 04:05:17jaracosetrecipients: + jaraco
2018-01-07 04:05:17jaracosetmessageid: <1515297917.31.0.467229070634.issue32509@psf.upfronthosting.co.za>
2018-01-07 04:05:17jaracolinkissue32509 messages
2018-01-07 04:05:16jaracocreate