Skip to content

Bugfix/fix use of assert 2015 - #2023

Merged
peterjc merged 20 commits into
biopython:masterfrom
benjaminr:bugfix/fix-use-of-assert-2015
Apr 22, 2019
Merged

peterjc merged 20 commits into
biopython:masterfrom
benjaminr:bugfix/fix-use-of-assert-2015

Conversation

@benjaminr

Copy link
Copy Markdown
Contributor

This pull request addresses issue #2015

  • 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.)

@benjaminr
benjaminr requested a review from peterjc as a code owner April 21, 2019 16:37
@codecov

codecov Bot commented Apr 21, 2019

Copy link
Copy Markdown

Codecov Report

Merging #2023 into master will decrease coverage by 0.92%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2023      +/-   ##
==========================================
- Coverage   85.09%   84.16%   -0.93%     
==========================================
  Files         314      296      -18     
  Lines       50311    47327    -2984     
==========================================
- Hits        42810    39834    -2976     
+ Misses       7501     7493       -8
Impacted Files Coverage Δ
Bio/AlignIO/EmbossIO.py 75.75% <0%> (+0.56%) ⬆️
Bio/SeqIO/PirIO.py 88.37% <0%> (ø) ⬆️
Bio/SeqIO/QualityIO.py 72.01% <0%> (ø) ⬆️
Bio/SwissProt/__init__.py 92.66% <0%> (ø) ⬆️
Bio/Phylo/CDAOIO.py 5.42% <0%> (-80.1%) ⬇️
Bio/Graphics/__init__.py 25% <0%> (-58.34%) ⬇️
Bio/Phylo/CDAO.py 42.85% <0%> (-57.15%) ⬇️
Bio/_py3k/__init__.py 41.66% <0%> (-34.53%) ⬇️
Bio/SeqIO/NibIO.py 77.17% <0%> (-14.14%) ⬇️
Bio/Phylo/_cdao_owl.py 89.47% <0%> (-10.53%) ⬇️
... and 48 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 ad4fe9b...798c5cd. Read the comment docs.

@codecov

codecov Bot commented Apr 21, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #2023 into master will increase coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2023      +/-   ##
==========================================
+ Coverage   85.09%   85.09%   +<.01%     
==========================================
  Files         314      314              
  Lines       50311    50310       -1     
==========================================
  Hits        42810    42810              
+ Misses       7501     7500       -1
Impacted Files Coverage Δ
Bio/AlignIO/EmbossIO.py 75.75% <0%> (+0.56%) ⬆️
Bio/SeqIO/PirIO.py 88.37% <0%> (ø) ⬆️
Bio/SeqIO/QualityIO.py 72.01% <0%> (ø) ⬆️
Bio/SwissProt/__init__.py 92.66% <0%> (ø) ⬆️

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 e465ab3...3de5112. Read the comment docs.

@peterjc peterjc left a comment

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.

Generally looks very good - I only spotted a couple of issues by eye.

Comment thread Bio/AlignIO/EmbossIO.py Resolved
Comment thread Bio/AlignIO/EmbossIO.py Resolved
Comment thread Tests/common_BioSQL.py Resolved
Comment thread Tests/test_SffIO.py Outdated
assert False, "Should fail!"
except ValueError:
pass
raise ValueError("Should fail.")

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.

I think you've accidentally flipped the meaning of the test. This looks like another case were we could use self.assertRaises(ValueError)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As this wasn't a part of a unittest TestCase, I've called the function directly instead of accessing via a reference to self. Not sure if it was the best way to go about it, or if a new TestCase would be more appropriate.

@peterjc peterjc Apr 22, 2019 •

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're absolutely right - I didn't see that from the context of the diff. Does this new form work nicely (I've never used it that way myself).

P.S. As per the comment at the start of that if statement, this code isn't a test, but rather a record of how some of the test cases were generated programatically (they are binary files).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As far as I'm aware, it works equivalently and it appeared to work okay locally on my machine.

@peterjc

peterjc commented Apr 22, 2019

Copy link
Copy Markdown
Member

While we wait for the automated testing: Do you have strong views on a squash-and-merge as a single commit, versus keeping your full commit history, for this pull request?

@benjaminr

Copy link
Copy Markdown
Contributor Author

While we wait for the automated testing: Do you have strong views on a squash-and-merge as a single commit, versus keeping your full commit history, for this pull request?

Nope, happy to squash-and-merge, makes everything cleaner 👍

@peterjc

peterjc commented Apr 22, 2019

Copy link
Copy Markdown
Member

I'll deal with the merge now (and the trivial conflict)...

…se ValueError instead of assert call in EmbossIterator.
…on a base class, more descriptive ValueError and correcting misunderstood error.
@peterjc
peterjc force-pushed the bugfix/fix-use-of-assert-2015 branch from e3b1331 to 3de5112 Compare April 22, 2019 10:16
peterjc added a commit to peterjc/biopython that referenced this pull request Apr 22, 2019
@peterjc
peterjc merged commit 592febd into biopython:master Apr 22, 2019
peterjc added a commit that referenced this pull request Apr 22, 2019
svalqui pushed a commit to svalqui/biopython that referenced this pull request May 14, 2019
Mainly replaced assert statements with raise ValueError instead.
svalqui pushed a commit to svalqui/biopython that referenced this pull request May 14, 2019
peterjc added a commit to peterjc/biopython that referenced this pull request Sep 2, 2019
peterjc added a commit that referenced this pull request Nov 4, 2019
Named copyright holders and other contributors tracked with version
control have all agreed:

 - Benjamin Rowell (@benjaminr)
   #2023
 - Brad Chapman (@chapmanb)
   http://mailman.open-bio.org/pipermail/biopython-dev/2013-July/019903.html
 - Chris Warth (@cswarth)
   #898 (comment)
 - Christian Brueffer (@cbrueffer)
   #898 (comment)
 - Eric Talevich (@etal)
   #898 (comment)
 - Francesco Gastaldello (@Gasta88)
   #1063
 - Frank Kauff (@frankkl)
   #2246 (comment)
 - Iddo Friedberg (@idoerg)
   #898 (comment)
 - Joe Cora (@JoeCora)
   #898 (comment)
 - Michiel de Hoon (@mdehoon)
   #898 (comment)
 - Milind Luthra (@milindl)
   #1020
 - Nick Negretti (@nimne)
   #1768 (comment)
 - Peter Cock (@peterjc)
   #898 (comment)
 - Sourav Singh (@souravsingh)
   #957
 - Steve Bond (@biologyguy)
   #898 (comment)
 - Tiago Antao (@tiagoantao)
   #898 (comment)
 - Vincent Davis (@vincentdavis)
   #898 (comment)
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