[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2021-02-07 Thread Jason R. Coombs
Jason R. Coombs added the comment: Today I encountered another situation where it would be convenient to allow an ellipsis at the beginning of the syntax: >>> pathlib.Path('abc') ...Path('abc') Because pathlib.Path resolves to `PosixPath` and `WindowsPath` depending on the platform, it

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2021-01-16 Thread Jason R. Coombs
Jason R. Coombs added the comment: I've encountered this issue again with a different use-case. I'm attempting to add a doctest to a routine that emits the paths of the files it processes. I want to use ellipses to ignore the prefixes of the output because they're not pertinent to the test.

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2019-05-13 Thread Michael Blahay
Michael Blahay added the comment: At the end of msg309603 it was stated that this issue is being changed to an enhancement. Later on, Tim Peters changed it Type back to behavior, but didn't provide any detail about why. Should this issue still be considered an enhancement? -- nosy:

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-07 Thread Tim Peters
Tim Peters added the comment: By the way, going back to your original problem, "the usual" solution to that different platforms can list directories in different orders is simply to sort the listing yourself. That's pretty easy in Python ;-) Then your test can verify the

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-07 Thread Tim Peters
Tim Peters added the comment: Jason, an ellipsis will match an empty string. But if your expected output is: """ x... abcd ... """ you're asking for output that: - starts with "x" - followed by 0 or more of anything - FOLLOWED BY A NEWLINE (I think you're overlooking this

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-07 Thread Jason R. Coombs
Jason R. Coombs added the comment: Thank you Steven for creating a reproduction of the issue; I should have done that in the first place. I have the +ELLIPSIS enabled elsewhere in the test suite, which is why it didn't appear in my example. I should clarify - what I

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: Tim Peters said: > Right, "..." immediately after a ">>>" line is taken to indicate a code > continuation line, and there's no way to stop that short of rewriting the > parser. I haven't gone through the source in detail, but it

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-06 Thread Tim Peters
Tim Peters added the comment: And I somehow managed to unsubscribe Steven :-( -- nosy: +steven.daprano ___ Python tracker ___

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-06 Thread Tim Peters
Tim Peters added the comment: Right, "..." immediately after a ">>>" line is taken to indicate a code continuation line, and there's no way to stop that short of rewriting the parser. The workaround you already found could be made more palatable if you weren't determined to

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: Oops, somehow managed to accidentally unsubscribe r.david.murray -- nosy: +r.david.murray ___ Python tracker

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: Here's a simple demonstration of the issue: # --- cut %< --- import doctest def hash_files(): """ >>> hash_files() # doctest: +ELLIPSIS ... d41d8cd98f00b204e9800998ecf8427e __init__.py ... """

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-06 Thread R. David Murray
R. David Murray added the comment: Ah, I see my answer crossed with your post :) -- ___ Python tracker ___

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-06 Thread R. David Murray
R. David Murray added the comment: What happens if you print a placeholder line first, before your test output? I'm not sure it will work, I seem to remember something about an ellipses starting a line just not being supported, but it was a long time ago... So, that

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-06 Thread Jason R. Coombs
Jason R. Coombs added the comment: I did find [this ugly workaround](https://github.com/jaraco/jaraco.financial/commit/9b866ab7117d1cfc26d7cdcec10c63a608662b46): >>> print('x' + res) x... -- ___ Python tracker

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-06 Thread Jason R. Coombs
New submission from Jason R. Coombs : 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): """