Repository navigation
Remove redundant self test from Bio.GenBank.Scanner - #1936
Conversation
… test_GenBank_unitest.
|
Thank you for working on this - the initial pull request is a good start, but I'd like to see some large changes (in terms of lines of code - conceptually the change is small). Currently we do use However, I don't think we necessarily have to use the same GenBank and EMBL examples to do this - probably many of the existing examples under If there is something interesting about these test files which makes them worth retaining, then I don't see any reason to keep them as text embedded in the Python code, when as part of the main test framework they could more usefully be files under So, please either remove the embedded files completely (and test using existing GenBank or EMBL test files), or move the embedded files to files on disk. |
|
Ok, no worries I'll review the files available and update. |
Codecov Report
@@ Coverage Diff @@
## master #1936 +/- ##
==========================================
+ Coverage 85.02% 85.03% +<.01%
==========================================
Files 310 310
Lines 49957 49960 +3
==========================================
+ Hits 42476 42481 +5
+ Misses 7481 7479 -2
Continue to review full report at Codecov.
|
| if do_features: | ||
| l_gb_r = list(self.gb_s.parse_records(handle, do_features=True)) | ||
| else: | ||
| l_gb_r = list(self.gb_s.parse_records(handle, do_features=False)) |
There was a problem hiding this comment.
Wouldn't one line instead of four be enough:
l_gb_r = list(self.gb_s.parse_records(handle, do_features= do_features))| def gb_to_l_r(self, filename, do_features=False): | ||
| """Gb file to Seq list parse records.""" | ||
|
|
||
| handle = open(filename, 'r') |
There was a problem hiding this comment.
Could you use a context manager here please,
with open(filename) as handle:
# codenot:
handle = open(filename)
# code
handle.close()Also there is no need to specify the mode since "r" is the default.
| """Test EMBL CDS interaction, parse CDS features on embl files.""" | ||
|
|
||
| # Test parse CDS features on embl_file | ||
| handle_embl7046 = open("EMBL/AE017046.embl", "r") |
There was a problem hiding this comment.
Again, context manager please:
with open("EMBL/AE017046.embl") as handle:
embl_s = Scanner.EmblScanner()
l_cds_f = list(embl_s.parse_cds_features(handle))| """Test EMBL Record interaction on embl files.""" | ||
|
|
||
| # Test parse records on embl_file | ||
| handle_embl7046 = open("EMBL/AE017046.embl", "r") |
There was a problem hiding this comment.
Again, please use a context manager.
There was a problem hiding this comment.
Using context manager for all now; all good, I think is ready now.
|
Are you happy to do a little more polishing? Using context managers is recommend style over explicitly closing file handles. |
|
Merged, thank you! |
This pull request addresses issue #820
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.)