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

Formatting doctests in doc strings #745

Closed
ChrisWellsWood opened this issue Mar 13, 2019 · 2 comments
Closed

Formatting doctests in doc strings #745

ChrisWellsWood opened this issue Mar 13, 2019 · 2 comments
Labels
T: enhancement New feature or request

Comments

@ChrisWellsWood
Copy link

I often find myself writing a doctest, pasting it into a separate file, formatting it with Black then pasting it back into the doc string. It'd be very convenient if Black formatted the code in doctests, maybe it could be behind a flag.

I saw @ambv saying that doc strings are out of scope in another issue (#144 (comment)) but I see less controversy about formatting the doctests as they're code.

@JelleZijlstra JelleZijlstra added the T: enhancement New feature or request label May 5, 2019
@mattharrison
Copy link

I wanted to see how applying black to the code (written as doctests) would look in my upcoming book. So I wrote a script to do it here.

https://gist.github.com/mattharrison/2a1a263597d80e99cf85e898b800ec32

@ambv
Copy link
Collaborator

ambv commented Mar 4, 2020

We'll decide whether to do this as part of #144.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants