Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple semicolon separated commands are not handled well #143

Closed
jugmac00 opened this issue Sep 9, 2022 · 4 comments · Fixed by #155
Closed

multiple semicolon separated commands are not handled well #143

jugmac00 opened this issue Sep 9, 2022 · 4 comments · Fixed by #155

Comments

@jugmac00
Copy link

jugmac00 commented Sep 9, 2022

>>> 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
Copy link
Owner

keewis commented Sep 10, 2022

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
Copy link
Author

jugmac00 commented Sep 12, 2022

@keewis For now, as a workaround, I converted the above statements into a single one.

-    >>> print("----")
--
+    >>> print("----\n%s" % anon_browser.contents)

@keewis
Copy link
Owner

keewis commented Oct 12, 2022

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
Copy link
Author

Indeed. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants