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 tim.peters
Recipients jaraco, r.david.murray, steven.daprano, tim.peters
Date 2018-01-07.17:51:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1515347474.76.0.467229070634.issue32509@psf.upfronthosting.co.za>
In-reply-to
Content
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 part)
- followed by "abcd" and a newline
- followed by 0 or more of anything
- followed by (and ending) with a newline

So, e.g., "xabcd\n" doesn't match - not because of the ellipsis, but because of the newline following the first ellipsis.  You can repair that by changing the expected output like so:

"""
x...abcd
...
"""

This still requires that "abcd" is _followed_ by a newline, but puts no constraints on what appears before it.

In your specific context, it seems you want to say that your expected line has to appear _as_ its own line in your output, so that it must appear either at the start of the output _or_ immediately following a newline.

Neither ellipses nor a simple string search is sufficient to capture that notion.  Fancier code can do it, or a regexp search, or, e.g.,

what_i_want_without_the_trailing_newline in output.splitlines()
History
Date User Action Args
2018-01-07 17:51:14tim.peterssetrecipients: + tim.peters, jaraco, steven.daprano, r.david.murray
2018-01-07 17:51:14tim.peterssetmessageid: <1515347474.76.0.467229070634.issue32509@psf.upfronthosting.co.za>
2018-01-07 17:51:14tim.peterslinkissue32509 messages
2018-01-07 17:51:14tim.peterscreate