mdanalysis icon indicating copy to clipboard operation
mdanalysis copied to clipboard

Fix: groups.py doctest fixes

Open ljwoods2 opened this issue 2 years ago • 6 comments

Fixes #3925 in part

Changes made in this Pull Request:

  • Fixed all failing doctests in groups.py using sphinx directives
  • Updated groups.py with Black formatting

Note: These tests will not pass using "pytest -v --disable-pytest-warnings --doctest-modules " since I used sphinx directives to allow for concise example code. This can be changed but the documentation will become more verbose.

PR Checklist

  • [X ] Tests?
  • [ X] Docs?
  • [x] CHANGELOG updated?
  • [ X] Issue raised/referenced?

Developers certificate of origin


📚 Documentation preview 📚: https://mdanalysis--4374.org.readthedocs.build/en/4374/

ljwoods2 avatar Dec 20 '23 02:12 ljwoods2

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

Line 1279:80: E501 line too long (82 > 79 characters) Line 1280:80: E501 line too long (82 > 79 characters) Line 1281:80: E501 line too long (82 > 79 characters) Line 1282:80: E501 line too long (82 > 79 characters) Line 1283:80: E501 line too long (82 > 79 characters) Line 3068:80: E501 line too long (80 > 79 characters) Line 3082:80: E501 line too long (82 > 79 characters) Line 3203:1: W293 blank line contains whitespace Line 3206:80: E501 line too long (92 > 79 characters) Line 4734:80: E501 line too long (81 > 79 characters)

Comment last updated at 2024-03-25 17:59:45 UTC

pep8speaks avatar Dec 20 '23 02:12 pep8speaks

Linter Bot Results:

Hi @ljwoods2! Thanks for making this PR. We linted your code and found the following:

Some issues were found with the formatting of your code.

Code Location Outcome
main package ⚠️ Possible failure
testsuite ✅ Passed

Please have a look at the darker-main-code and darker-test-code steps here for more details: https://github.com/MDAnalysis/mdanalysis/actions/runs/8424742406/job/23069336974


Please note: The black linter is purely informational, you can safely ignore these outcomes if there are no flake8 failures!

github-actions[bot] avatar Dec 20 '23 02:12 github-actions[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 93.63%. Comparing base (0582265) to head (958a149).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4374      +/-   ##
===========================================
- Coverage    93.65%   93.63%   -0.03%     
===========================================
  Files          168      180      +12     
  Lines        21215    22294    +1079     
  Branches      3908     3908              
===========================================
+ Hits         19869    20875    +1006     
- Misses         888      961      +73     
  Partials       458      458              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Dec 20 '23 02:12 codecov[bot]

@IAlibay Done, I reverted a few things line-wise so I may have undone some PEP8 changes as well. In the future, should I change all the files I touch to be PEP-8 compliant, but not Black? Or do I only make the new code that I contribute PEP-8?

ljwoods2 avatar Dec 20 '23 18:12 ljwoods2

In the future, should I change all the files I touch to be PEP-8 compliant, but not Black? Or do I only make the new code that I contribute PEP-8?

The second one. New code should be PEP-8 compliant, but you should not fix other issues in the same file (will make review murkier). I know it's not great if you have linters on on your editor/IDE because of the large amount of errors you see, but until we decide to reformat the whole code base, this remains the best way forward for the project. If you feel strongly about this, please add your view/experience in https://github.com/MDAnalysis/mdanalysis/issues/2450.

RMeli avatar Dec 21 '23 09:12 RMeli

Cycling the PR to restart Codecov action.

RMeli avatar Dec 21 '23 22:12 RMeli

FYI, this is what the passing doctests look like

Document: documentation_pages/core/groups
-----------------------------------------
~/mdanalysis/package/MDAnalysis/topology/PDBParser.py:331: UserWarning: Element information is missing, elements attribute will not be populated. If needed these can be guessed using MDAnalysis.topology.guessers.
  warnings.warn("Element information is missing, elements attribute "
~/mdanalysis/package/MDAnalysis/core/selection.py:735: UserWarning: Your smarts-based atom selection returned the maxnumber of matches. This indicates that not allmatching atoms were selected. When callingatom_group.select_atoms(), the default valueof maxMatches is max(100, len(atom_group * 10)). To fix this, add the following argument to select_atoms: 
smarts_kwargs={maxMatches: <higher_value>}
  warnings.warn("Your smarts-based atom selection returned the max"
19 items passed all tests:
  16 tests in AtomGroup
  11 tests in AtomGroup.asunique
   7 tests in AtomGroup.select_atoms
   1 tests in AtomGroup.select_atoms.namedarguments
   1 tests in AtomGroup.select_atoms.smarts
   1 tests in AtomGroup.select_atoms.updating
  10 tests in AtomGroup.sort
  10 tests in AtomGroup.unique
  30 tests in GroupBase.center
  15 tests in GroupBase.concatenate
  12 tests in GroupBase.groupby
  18 tests in GroupBase.isunique
  12 tests in GroupBase.subtract
  12 tests in GroupBase.symmetric_difference
  12 tests in GroupBase.union
   7 tests in ResidueGroup.asunique
   7 tests in ResidueGroup.unique
   7 tests in SegmentGroup.asunique
   7 tests in SegmentGroup.unique
196 tests in 19 items.
196 passed and 0 failed.
Test passed.

orbeckst avatar Mar 25 '24 19:03 orbeckst