Repository navigation
Fixed multiline assert statements in Bio folder, issue #1515 - #1748
Conversation
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, |
There was a problem hiding this comment.
Does this give a sensible error message? It would probably be better to build an explicit message string here.
| "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" |
There was a problem hiding this comment.
On GitHub this looks like too much indentation, it should be four spaces more.
| - Chris Rands | ||
| - Kai Blin | ||
| - Maximilian Greil | ||
| - Nick Negretti |
There was a problem hiding this comment.
You can add (first contribution) to your name here :)
|
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 Report
@@ 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
Continue to review full report at Codecov.
|
|
Thanks for the feedback! I've fixed those specific problems. Looking forward to other comments and review. |
|
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? |
|
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 👍 |
Closes biopython#1515, thanks to work in pull request biopython#1748 and pull request biopython#1728.
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.rstfile and understand that AppVeyor andTravisCI will be used to confirm the Biopython unit tests and
flake8stylechecks pass with these changes.
I have added my name to the alphabetical contributors listings in the files
NEWS.rstandCONTRIB.rstas part of this pull request, am listedalready, or do not wish to be listed. (This acknowledgement is optional.)