-
Notifications
You must be signed in to change notification settings - Fork 148
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
testing/docs: Include doctests in testing #168
Conversation
…sting add doctests to some modules
Codecov Report
@@ Coverage Diff @@
## master #168 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 9 9
Lines 560 569 +9
=========================================
+ Hits 560 569 +9
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
@hugovk I took care of all the whitespace issues |
'something else' | ||
>>> ordinal(None) is None | ||
True | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, is this newline needed, and those for subsequent ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes if there isn't a space between the three backticks and the test result doctests report it as a failure for some reason.
for example:
>>> precisedelta(delta, suppress=['seconds', 'milliseconds', 'microseconds'])
'1.50 minutes'
```
Doctests will return:
precisedelta(delta, suppress=['seconds', 'milliseconds', 'microseconds'])
Expected:
'1.50 minutes'
```
Got:
'1.50 minutes'
When there's a blank line between them it passes with no failure.
I kept the...
```pycon
*documentation*
\```
...format because I noticed it in other tests that were accepted before and I'm assuming it's there for highlighting or has something to do with the readthedocs page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough!
Yes, pycon
is for syntax highlighting on RTD.
Thanks, I think this is ready for merge!
add a section to "tox.ini" that includes doctests in testing
add doctests to some modules
Changes proposed in this pull request:
I noticed that there were already doctests in some of the modules but they were not being tested. I Think it would be great to include them in testing with the added benefit of the doctests showing examples of how to use the modules.
I got the idea to do this when I found the documentation bug months ago that was patched in this commit