Repository navigation
Apply black style to test_Restriction.py, version 19.10b0. - #2833
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2833 +/- ##
==========================================
- Coverage 84.16% 84.15% -0.01%
==========================================
Files 319 319
Lines 50201 50201
==========================================
- Hits 42251 42247 -4
- Misses 7950 7954 +4
Continue to review full report at Codecov.
|
| EarI, | ||
| SnaI, | ||
| SphI, | ||
| ) |
There was a problem hiding this comment.
My personal preference would be:
from Bio.Restriction import Acc65I
...
from Bio.Restriction import SphISee discussion on #2828 - we have yet to agree any particular style, so this is fine for now.
There was a problem hiding this comment.
My personal preference would be to let it stand as it was, but let black do what black wants to do here.
There was a problem hiding this comment.
Yes, leave it as is for now - we can settle any preferred import style later on the linked issue.
| self.assertEqual( | ||
| str(FormattedSeq(Seq("GATC"))), "FormattedSeq(Seq('GATC'), linear=True)" | ||
| ) | ||
| self.assertFalse(FormattedSeq(Seq("GATC")) == FormattedSeq(Seq("TAGC"))) |
There was a problem hiding this comment.
@svalqui Sorry for this request, although not black-related but still style-related: Can you change all assertFalse(a==b) and assertTrue(a==b) into assertNotEqual(a, b) and assertEqual(a, b)?
There was a problem hiding this comment.
Not only here but in the whole file?
There was a problem hiding this comment.
Logged #2835 for the wider issue, but happy for you to fix this file as part of this pull request, or leave it for later.
There was a problem hiding this comment.
updated, but left one that doesn't pass the test.
self.assertNotEqual(Acc65I, Asp718I)
AssertionError: Acc65I == Asp718I
I think is mean to use assertNotEqual.
There was a problem hiding this comment.
This is a special thing within Bio.Restriction, __eq__ (==) and __ne__ (!=) have been overriden with different meanings. In this case Acc65I and Asp718I are neither equal (they are not the same enzyme) nor not equal (they are isoschizomers, doing exactly the same thing).
Thus assertFalse is the only method which allows to test both. OK.
There was a problem hiding this comment.
I'd forgotten about that quirk. Best or at least standard practise is __eq__ and __ne__ give the negation of each other, but as here that isn't required.
There was a problem hiding this comment.
@peterjc @MarkusPiotrowski Perhaps I'm new here, but is there any reason why the __ne__ operator is used to check for isoschizomer-ness? It doesn't seem very convenient if it confuses the linter and tests (and potentially humans too). When I first saw this behavior in the tests, I thought it was a bug.
There was a problem hiding this comment.
I would agree in hindsight this was a poor design choice. We have been looking at replacing the entirety of the old restriction digest module anyway.
There was a problem hiding this comment.
@peterjc Thank you for the clarification, and I look forward to seeing the new design!
| EarI, | ||
| SnaI, | ||
| SphI, | ||
| ) |
There was a problem hiding this comment.
My personal preference would be to let it stand as it was, but let black do what black wants to do here.
…ertNotEqual(a, b) and assertEqual(a, b).
|
Thank you both |
This pull request addresses issue #2552
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, have runflake8locally, andunderstand that AppVeyor and TravisCI will be used to confirm the Biopython unit
tests and style checks 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.)
This PR applies black style to test_Restriction.py. few changes but should be fine to merge.