Skip to content

Fixed multiline assert statements in Bio folder, issue #1515 - #1748

Merged
peterjc merged 4 commits into
biopython:masterfrom
nimne:assert_multiline
Aug 22, 2018
Merged

peterjc merged 4 commits into
biopython:masterfrom
nimne:assert_multiline

Conversation

@nimne

@nimne nimne commented Aug 6, 2018

Copy link
Copy Markdown
Contributor

This pull request addresses issue #1515

Most of the multi-line assert statements in the Bio folder were changed to errors. The few that remain are either in comments, or I couldn't determine an obvious substitution.

Unit tests (that I was able to install dependences for) passed locally, with the exception of test_partial_diagram, but that appears to be related to ReportLab 3.5.0.

  • I hereby agree to dual licence this and any previous contributions under both
    the Biopython License Agreement AND the BSD 3-Clause License.

  • I have read the CONTRIBUTING.rst file and understand that AppVeyor and
    TravisCI will be used to confirm the Biopython unit tests and flake8 style
    checks pass with these changes.

  • I have added my name to the alphabetical contributors listings in the files
    NEWS.rst and CONTRIB.rst as part of this pull request, am listed
    already, or do not wish to be listed. (This acknowledgement is optional.)

nimne added 2 commits August 5, 2018 17:22
Fixing multiline assert statements in reference to  biopython#1515. Specifically fixing the multiline assert statements that return error messages.
Fixed nearly all multiline assert statements in Bio folder, in reference to biopython#1515.
assert startangle <= tailangle <= headangle <= endangle, \
(startangle, tailangle, headangle, endangle, angle)
if not startangle <= tailangle <= headangle <= endangle:
raise RuntimeError(startangle, tailangle,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this give a sensible error message? It would probably be better to build an explicit message string here.

Comment thread Bio/SearchIO/BlatIO.py Outdated
"Unequal start coordinates and block sizes list (%r vs %r)" \
% (len(starts), len(blksizes))
if len(starts) != len(blksizes):
raise RuntimeError("Unequal start coordinates and block sizes list"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On GitHub this looks like too much indentation, it should be four spaces more.

Comment thread NEWS.rst Outdated
- Chris Rands
- Kai Blin
- Maximilian Greil
- Nick Negretti

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add (first contribution) to your name here :)

@peterjc

peterjc commented Aug 11, 2018

Copy link
Copy Markdown
Member

I've looked over the changes by eye, and made some minor comments - I'm happy with the changes in principle.

Good work. The AppVeyor ReportLab failure is covered by #1737, so don't worry about that.

However, since this touches lots of modules I would ideally like their authors/owners to comments - e.g. @widdowquinn for the GenomeDiagram asserts (and those others who should have already got a review request).

@codecov

codecov Bot commented Aug 11, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #1748 into master will decrease coverage by 0.15%.
The diff coverage is 44.73%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1748      +/-   ##
==========================================
- Coverage   85.59%   85.44%   -0.16%     
==========================================
  Files         331      331              
  Lines       50105    50200      +95     
==========================================
+ Hits        42889    42891       +2     
- Misses       7216     7309      +93
Impacted Files Coverage Δ
Bio/PDB/ResidueDepth.py 53.91% <0%> (-0.16%) ⬇️
Bio/KEGG/KGML/KGML_pathway.py 79.13% <22.22%> (-1.98%) ⬇️
Bio/motifs/transfac.py 78.84% <25%> (-3.16%) ⬇️
Bio/Nexus/Nexus.py 72.33% <33.33%> (-0.18%) ⬇️
Bio/SearchIO/BlastIO/blast_xml.py 94.11% <33.33%> (-0.65%) ⬇️
Bio/SeqIO/_index.py 93.66% <50%> (-0.45%) ⬇️
Bio/Phylo/BaseTree.py 89.21% <50%> (-0.18%) ⬇️
Bio/SearchIO/ExonerateIO/exonerate_text.py 97.27% <50%> (-0.34%) ⬇️
Bio/Graphics/GenomeDiagram/_CircularDrawer.py 88.95% <50%> (-0.26%) ⬇️
Bio/phenotype/__init__.py 91.07% <50%> (-1.66%) ⬇️
... and 18 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab0c1b9...b8b0c52. Read the comment docs.

@nimne

nimne commented Aug 11, 2018

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback! I've fixed those specific problems.

Looking forward to other comments and review.

@peterjc

peterjc commented Aug 12, 2018

Copy link
Copy Markdown
Member

The test coverage numbers from codecov have actually got slightly worse, but that is to be expected (as the changes have added a few lines of code but none of our tests were triggering the asserts, so won't trigger the new exceptions).

So don't worry about the red crosses from codecov's automated checks here.

@MarkusPiotrowski you had some good insights on #1515, do you want to review or comment on this pull request?

@peterjc
peterjc merged commit e383839 into biopython:master Aug 22, 2018
@peterjc

peterjc commented Aug 22, 2018

Copy link
Copy Markdown
Member

I think this is a useful improvement as is - so I've gone ahead and merged it. We can of course make further refinements later if needed.

Thank you Nick 👍

peterjc added a commit that referenced this pull request Aug 22, 2018
Closes #1515, thanks to work in pull request #1748
@nimne
nimne deleted the assert_multiline branch August 23, 2018 18:54
peterjc added a commit to peterjc/biopython that referenced this pull request Aug 24, 2018
Closes biopython#1515, thanks to work in pull request biopython#1748
and pull request biopython#1728.
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