multiple semicolon separated commands are not handled well
Closed this issue · 4 comments
jugmac00 commented
>>> print("----");print(anon_browser.contents)
gets turned into
>>> print("----")
... print(anon_browser.contents)
When I then tried to run the doctests I got a
SyntaxError: multiple statements found while compiling a single statement
keewis commented
this is not actually hard to do (and even easier after #144). However, we'd need to analyze the AST to implement it, which up until now was left entirely to black
. Let me see what I can do.
jugmac00 commented
@keewis For now, as a workaround, I converted the above statements into a single one.
- >>> print("----")
--
+ >>> print("----\n%s" % anon_browser.contents)
keewis commented
this will be fixed in the next version, but you could also just pass both to a single print
call:
>>> print("----", anon_browser.contents, sep="\n")
which is probably better, given that splitting the print
calls into separate doctest lines makes the ----
a bit pointless?
jugmac00 commented
Indeed. 👍