-
Notifications
You must be signed in to change notification settings - Fork 672
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
Fixing some doctests. #4118
Fixing some doctests. #4118
Conversation
Linter Bot Results:Hi @AHMED-salah00! Thanks for making this PR. We linted your code and found the following: Some issues were found with the formatting of your code.
Please have a look at the Please note: The |
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## develop #4118 +/- ##
========================================
Coverage 93.59% 93.59%
========================================
Files 192 192
Lines 25134 25134
Branches 4056 4056
========================================
Hits 23524 23524
Misses 1092 1092
Partials 518 518
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
@@ -109,6 +109,7 @@ | |||
Examples | |||
-------- | |||
|
|||
>>> from MDAnalysis.lib.transformations import identity_matrix |
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.
What about the other functions such as rotation_matrix
, euler_from_matrix
, ...? (Same comment applies elsewhere).
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.
Hmm, I really didn't take that in mind. I will import them too.
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.
@AHMED-salah00 I took me a while to figure this out, but #3997 added the doctests to CI. These never fail, so you need to dig them up yourself and see.
For this PR, you can go under the "Checks" tab, look for the "build_docs" test under the "GH Actions CI" menu on the left, and then look at (expand) the "doctest" phase. If you search for lib/transformations.py
you can see the current failures (due to missing rotation_matrix
, etc.). You can do the same for the other files you touched in this PR and hopefully fix all the current issues.
@MDAnalysis/coredevs I think here it would be more useful to have CI tests that can be incrementally turned on (instead of a single CI test for everything that never fails) when a file is addressed and fixed, so that we can ensure a PR is OK (by turning on the checks for the current files) and more importantly that no more issues are re-introduced later on. Would this be possible with doctests?
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.
Not easily afaik - at least not with the current way we're invoking things (coming up with more complex solutions might take a while). I think the original suggestion was for reviewers to compare against the last merge commit and see if the numbers went up or down.
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 @RMeli for this found lots of failing docs here :)
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.
Indeed. =) Please focus only on one or a few files at a time, to keep PRs of reasonable size (thus easier to review and merge). For the current PR I'd fix all the issues in the files you already touched:
core/universe.py
lib/transformations.py
lib/util.py
@@ -109,6 +109,7 @@ | |||
Examples | |||
-------- | |||
|
|||
>>> from MDAnalysis.lib.transformations import identity_matrix |
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.
@AHMED-salah00 I took me a while to figure this out, but #3997 added the doctests to CI. These never fail, so you need to dig them up yourself and see.
For this PR, you can go under the "Checks" tab, look for the "build_docs" test under the "GH Actions CI" menu on the left, and then look at (expand) the "doctest" phase. If you search for lib/transformations.py
you can see the current failures (due to missing rotation_matrix
, etc.). You can do the same for the other files you touched in this PR and hopefully fix all the current issues.
@MDAnalysis/coredevs I think here it would be more useful to have CI tests that can be incrementally turned on (instead of a single CI test for everything that never fails) when a file is addressed and fixed, so that we can ensure a PR is OK (by turning on the checks for the current files) and more importantly that no more issues are re-introduced later on. Would this be possible with doctests?
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.
lib/transformations.py
LGTM:
Document: documentation_pages/lib/transformations
-------------------------------------------------
1 items passed all tests:
160 tests in default
160 tests in 1 items.
160 passed and 0 failed.
Test passed.
For the other two files, there are still several test failing. I commented on the ones close to or related to the code you changed, but there are others as you can see in the log (especially in lib.util.py
). Please double check and fix them.
package/MDAnalysis/core/universe.py
Outdated
@@ -1416,9 +1419,9 @@ def from_smiles(cls, smiles, sanitize=True, addHs=True, | |||
To use a different conformer generation algorithm, like ETKDGv3: | |||
|
|||
>>> u = mda.Universe.from_smiles('CCO', rdkit_kwargs=dict( | |||
params=AllChem.ETKDGv3())) | |||
... params=AllChem.ETKDGv3())) |
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.
/home/runner/work/mdanalysis/mdanalysis/package/doc/sphinx/source/../../../MDAnalysis/core/universe.py.rst: WARNING: ignoring invalid doctest code: ">>> u = mda.Universe.from_smiles('CCO', rdkit_kwargs=dict(\n ... params=AllChem.ETKDGv3()))\n>>> u.trajectory\n<RDKitReader with 10 frames of 9 atoms>"
Please format properly, so that this line is not invalid.
package/MDAnalysis/core/universe.py
Outdated
>>> u.add_TopologyAttr('bfactors') | ||
>>> u.atoms.bfactors |
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.
This is unrelated to your changes, therefore feel free to ignore the following comment if you don't want to address it in this PR or at all.
I can see from the log that there are some warnings because bfactors
has been deprecated (and will be removed in 3.0).
/home/runner/work/mdanalysis/mdanalysis/package/MDAnalysis/core/universe.py:828: DeprecationWarning: The bfactor topology attribute is only provided as an alias to the tempfactor attribute. It will be removed in 3.0. Please use the tempfactor attribute instead.
If you want/have time you could fix this warning as well (which will become an error down the line) by replacing bfactor
with tempfactor
(and bfactors
with tempfactors
).
@@ -109,6 +109,8 @@ | |||
Examples | |||
-------- | |||
|
|||
>>> from MDAnalysis.lib.transformations import * | |||
>>> import numpy |
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.
I think if would be better to change the whole test to be consistent with the others and use import numpy as np
.
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.
Document: documentation_pages/core/universe
-------------------------------------------
1 items passed all tests:
24 tests in default
24 tests in 1 items.
24 passed and 0 failed.
Test passed.
Document: documentation_pages/lib/transformations
-------------------------------------------------
1 items passed all tests:
160 tests in default
160 tests in 1 items.
160 passed and 0 failed.
Test passed.
Document: documentation_pages/lib/util
--------------------------------------
1 items passed all tests:
30 tests in default
30 tests in 1 items.
30 passed and 0 failed.
Test passed.
LGTM, thanks @AHMED-salah00
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.
lgtm!
Portion of #3925
Changes made in this Pull Request:
Fixed the doctests in the following files:
core/universe.py
.lib/transformations.py
.lib/util.py
.PR Checklist
📚 Documentation preview 📚: https://readthedocs-preview--4118.org.readthedocs.build/en/4118/