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

Fix/doctests #497

Closed
wants to merge 20 commits into from
Closed

Conversation

Moritz-Alexander-Kern
Copy link
Member

@Moritz-Alexander-Kern Moritz-Alexander-Kern commented Jun 23, 2022

doctests

The doctest module looks for such sequences of prompts in a docstring, re-executes the extracted command and checks the output against the output of the command given in the docstrings test example.

Many doctrings in elephant contain code examples using the following syntax:

  • When using the Python shell, the primary prompt: >>> , is followed by new commands.
  • The secondary prompt: ... , is used when continuing commands on multiple lines; and the result of executing the command is expected on following lines.
  • A blank line, or another line starting with the primary prompt is seen as the end of the output from the command.

So far elephant has no standardized form for doctests, which means, that some examples e.g. contain figures or don't produce any result. In those cases running doctests executes those examples and checks for errors, but does not check the results.

With this PR errors occurring during doctests are fixed and further steps aim to make doctests part of the Cx workflow.

This PR could be the starting point to establish doctests as a standard in elephant.

run only doctests

pytest elephant --doctest-modules --ignore=elephant/test/

todo:

@pep8speaks
Copy link

pep8speaks commented Jun 23, 2022

Hello @Moritz-Alexander-Kern! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2022-06-23 07:30:31 UTC

@Moritz-Alexander-Kern
Copy link
Member Author

This Pr was split in 2 parts and is done

@Moritz-Alexander-Kern Moritz-Alexander-Kern deleted the fix/doctests branch July 21, 2023 12:33
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 this pull request may close these issues.

2 participants