Message309611
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 seems to me that we could change OutputChecker.check_output to support this without touching the parser.
Ignoring issues of backwards compatibility for the moment, suppose we accept either '...' or '<ELLIPSIS>' as the wild card in the output section. Jason's example would then become:
>>> print(res) # docstring: +ELLIPSIS
<ELLIPSIS>
d41d8cd98f00b204e9800998ecf8427e __init__.py
...
check_output could replace the substring '<ELLIPSIS>' with three dots before doing anything else, and Bob's yer uncle.
Or in this case, Uncle Timmy's yer uncle :-)
There's probably a million details I haven't thought of, but it seems like a promising approach to me. I did a quick hack of doctest, adding
want = want.replace('<ELLIPSIS>', '...')
to the start of OutputChecker.check_output and it seems to work.
If this is acceptable, we'll probably need a directive to activate it, for the sake of backwards compatibility.
Thoughts? |
|
Date |
User |
Action |
Args |
2018-01-07 08:36:17 | steven.daprano | set | recipients:
+ steven.daprano, tim.peters, jaraco, r.david.murray |
2018-01-07 08:36:17 | steven.daprano | set | messageid: <1515314177.06.0.467229070634.issue32509@psf.upfronthosting.co.za> |
2018-01-07 08:36:17 | steven.daprano | link | issue32509 messages |
2018-01-07 08:36:16 | steven.daprano | create | |
|