Message309630
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() |
|
Date |
User |
Action |
Args |
2018-01-07 17:51:14 | tim.peters | set | recipients:
+ tim.peters, jaraco, steven.daprano, r.david.murray |
2018-01-07 17:51:14 | tim.peters | set | messageid: <1515347474.76.0.467229070634.issue32509@psf.upfronthosting.co.za> |
2018-01-07 17:51:14 | tim.peters | link | issue32509 messages |
2018-01-07 17:51:14 | tim.peters | create | |
|