Tim Peters <t...@python.org> 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 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()

----------

_______________________________________
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