From 8bdb61e2527528d882ea75627222641cb6c3dc0e Mon Sep 17 00:00:00 2001 From: Peter Cock Date: Fri, 27 Aug 2021 10:20:39 +0100 Subject: [PATCH] Automatically remove redundant commas Used this hack from https://github.com/psf/black/issues/1288 $ pip install black==19.3b0 && black . && pip install black==19.10b && black . I then manually reverted changes to a handful of explicit data structures where the magic trailing comma should be retained (indicates to black not to squash into one line). Doing this dramatically improves the changes from trying black version 21.7b0 (right now just four minor changes). --- Bio/AlignIO/MsfIO.py | 2 +- Bio/AlignIO/StockholmIO.py | 5 +---- Bio/Blast/Record.py | 2 +- Bio/GenBank/Scanner.py | 2 +- Bio/Nexus/Nexus.py | 6 +++--- Bio/PDB/internal_coords.py | 22 ++++---------------- Bio/SeqIO/FastaIO.py | 4 ++-- Bio/SeqIO/PirIO.py | 2 +- Bio/SeqIO/SffIO.py | 2 +- Bio/SeqIO/_index.py | 2 +- Bio/codonalign/__init__.py | 4 ++-- Bio/codonalign/codonalignment.py | 2 +- Bio/codonalign/codonseq.py | 4 +--- BioSQL/BioSeq.py | 2 +- Scripts/PDB/hsexpo.py | 2 +- Tests/common_BioSQL.py | 7 +------ Tests/pairwise2_testCases.py | 5 +---- Tests/test_AlignIO.py | 2 +- Tests/test_Align_emboss.py | 12 ++++------- Tests/test_BioSQL_sqlite3.py | 6 +----- Tests/test_CAPS.py | 2 +- Tests/test_Emboss.py | 6 +++--- Tests/test_Entrez.py | 12 +++++------ Tests/test_GenBank.py | 2 +- Tests/test_GenomeDiagram.py | 2 +- Tests/test_HMMGeneral.py | 4 +--- Tests/test_NCBI_qblast.py | 2 +- Tests/test_NaiveBayes.py | 13 +----------- Tests/test_PDB_Polypeptide.py | 4 ++-- Tests/test_PDB_parse_pdb_header.py | 8 +------- Tests/test_PhyloXML.py | 32 ++++++++++++++--------------- Tests/test_Phylo_matplotlib.py | 10 ++------- Tests/test_SCOP_Raf.py | 4 +--- Tests/test_SearchIO_blast_tab.py | 10 ++++----- Tests/test_SearchIO_exonerate.py | 2 +- Tests/test_SearchIO_fasta_m10.py | 2 +- Tests/test_SearchIO_hmmer3_text.py | 4 ++-- Tests/test_SeqIO.py | 33 ++++++++---------------------- Tests/test_SeqIO_TwoBitIO.py | 2 +- Tests/test_SeqIO_index.py | 4 ++-- Tests/test_SeqIO_online.py | 5 +---- Tests/test_Seq_objs.py | 21 ++++++------------- Tests/test_SwissProt.py | 2 +- Tests/test_TogoWS.py | 2 +- Tests/test_UniProt_GOA.py | 4 +--- Tests/test_cellosaurus.py | 2 +- Tests/test_codonalign.py | 6 ++---- Tests/test_pairwise_aligner.py | 8 +++----- Tests/test_prodoc.py | 4 ++-- Tests/test_seq.py | 9 +++----- 50 files changed, 107 insertions(+), 209 deletions(-) diff --git a/Bio/AlignIO/MsfIO.py b/Bio/AlignIO/MsfIO.py index d620f1b5b13..fe9957818bb 100644 --- a/Bio/AlignIO/MsfIO.py +++ b/Bio/AlignIO/MsfIO.py @@ -316,7 +316,7 @@ def __next__(self): ) records = ( - SeqRecord(Seq(s), id=i, name=i, description=i, annotations={"weight": w},) + SeqRecord(Seq(s), id=i, name=i, description=i, annotations={"weight": w}) for (i, s, w) in zip(ids, seqs, weights) ) diff --git a/Bio/AlignIO/StockholmIO.py b/Bio/AlignIO/StockholmIO.py index b98a36d6b34..582539a07c5 100644 --- a/Bio/AlignIO/StockholmIO.py +++ b/Bio/AlignIO/StockholmIO.py @@ -231,10 +231,7 @@ def _write_record(self, record): seq_name = seq_name.replace(" ", "_") if "start" in record.annotations and "end" in record.annotations: - suffix = "/%s-%s" % ( - record.annotations["start"], - record.annotations["end"], - ) + suffix = "/%s-%s" % (record.annotations["start"], record.annotations["end"]) if seq_name[-len(suffix) :] != suffix: seq_name = "%s/%s-%s" % ( seq_name, diff --git a/Bio/Blast/Record.py b/Bio/Blast/Record.py index de685651cf6..863324cc7c0 100644 --- a/Bio/Blast/Record.py +++ b/Bio/Blast/Record.py @@ -252,7 +252,7 @@ def __str__(self): else: lines.append( "Query:%8s %s...%s %s" - % (self.query_start, self.query[:45], self.query[-3:], self.query_end,) + % (self.query_start, self.query[:45], self.query[-3:], self.query_end) ) lines.append(" %s...%s" % (self.match[:45], self.match[-3:])) lines.append( diff --git a/Bio/GenBank/Scanner.py b/Bio/GenBank/Scanner.py index a62a01b25d3..db4bfd36394 100644 --- a/Bio/GenBank/Scanner.py +++ b/Bio/GenBank/Scanner.py @@ -529,7 +529,7 @@ def parse_records(self, handle, do_features=True): yield record def parse_cds_features( - self, handle, alphabet=None, tags2id=("protein_id", "locus_tag", "product"), + self, handle, alphabet=None, tags2id=("protein_id", "locus_tag", "product") ): """Parse CDS features, return SeqRecord object iterator. diff --git a/Bio/Nexus/Nexus.py b/Bio/Nexus/Nexus.py index ea39bab9fb8..c40a8470bca 100644 --- a/Bio/Nexus/Nexus.py +++ b/Bio/Nexus/Nexus.py @@ -416,7 +416,7 @@ def combine(matrices): combined.matrix[t] += Seq( str(m.matrix[t]) .replace(m.gap, combined.gap) - .replace(m.missing, combined.missing), + .replace(m.missing, combined.missing) ) # replace date of missing taxa with symbol for missing data for t in combined_only: @@ -425,7 +425,7 @@ def combine(matrices): combined.matrix[t] = Seq(combined.missing * combined.nchar) + Seq( str(m.matrix[t]) .replace(m.gap, combined.gap) - .replace(m.missing, combined.missing), + .replace(m.missing, combined.missing) ) combined.taxlabels.extend(m_only) # new taxon list for cn, cs in m.charsets.items(): # adjust character sets for new matrix @@ -1052,7 +1052,7 @@ def _matrix(self, options): # Reformat sequence for non-standard datatypes if self.datatype != "standard": iupac_seq = Seq( - _replace_parenthesized_ambigs(chars, self.rev_ambiguous_values), + _replace_parenthesized_ambigs(chars, self.rev_ambiguous_values) ) # first taxon has the reference sequence if matchhar is used if taxcount == 1: diff --git a/Bio/PDB/internal_coords.py b/Bio/PDB/internal_coords.py index 7452a957313..f9c4938efa4 100644 --- a/Bio/PDB/internal_coords.py +++ b/Bio/PDB/internal_coords.py @@ -84,17 +84,7 @@ from Bio.PDB.ic_data import ic_data_sidechain_extras, residue_atom_bond_state # for type checking only -from typing import ( - List, - Dict, - Set, - TextIO, - Union, - Tuple, - cast, - TYPE_CHECKING, - Optional, -) +from typing import List, Dict, Set, TextIO, Union, Tuple, cast, TYPE_CHECKING, Optional if TYPE_CHECKING: from Bio.PDB.Residue import Residue @@ -606,7 +596,7 @@ def init_atom_coords(self) -> None: a4shift[udFwd] = self.hedraIC[self.dH2ndx, 0][mdFwd] # len12 self.a4_pre_rotation[:, 2][self.dAtoms_needs_update] = numpy.add( - self.a4_pre_rotation[:, 2][self.dAtoms_needs_update], a4shift, + self.a4_pre_rotation[:, 2][self.dAtoms_needs_update], a4shift ) # so a2 at origin # build rz rotation matrix for dihedral angle @@ -1649,7 +1639,7 @@ def clear_transforms(self): d.rcst = None def assemble( - self, resetLocation: bool = False, verbose: bool = False, + self, resetLocation: bool = False, verbose: bool = False ) -> Union[Dict["AtomKey", numpy.array], Dict[HKT, numpy.array], None]: """Compute atom coordinates for this residue from internal coordinates. @@ -2841,11 +2831,7 @@ def __init__(self, *args: Union[List["AtomKey"], HKT], **kwargs: str) -> None: if "len12" in kwargs: self.lal = numpy.array( - ( - float(kwargs["len12"]), - float(kwargs["angle"]), - float(kwargs["len23"]), - ) + (float(kwargs["len12"]), float(kwargs["angle"]), float(kwargs["len23"])) ) else: self.lal = numpy.zeros(3) diff --git a/Bio/SeqIO/FastaIO.py b/Bio/SeqIO/FastaIO.py index 73abcd484c4..879ce5bff2f 100644 --- a/Bio/SeqIO/FastaIO.py +++ b/Bio/SeqIO/FastaIO.py @@ -203,7 +203,7 @@ def iterate(self, handle): # Should we use SeqRecord default for no ID? first_word = "" yield SeqRecord( - Seq(sequence), id=first_word, name=first_word, description=title, + Seq(sequence), id=first_word, name=first_word, description=title ) @@ -239,7 +239,7 @@ def iterate(self, handle): # Should we use SeqRecord default for no ID? first_word = "" yield SeqRecord( - Seq(sequence), id=first_word, name=first_word, description=title, + Seq(sequence), id=first_word, name=first_word, description=title ) diff --git a/Bio/SeqIO/PirIO.py b/Bio/SeqIO/PirIO.py index 7f3ae07a35b..1a916d42ad8 100644 --- a/Bio/SeqIO/PirIO.py +++ b/Bio/SeqIO/PirIO.py @@ -171,7 +171,7 @@ def iterate(self, handle): # Return the record and then continue... record = SeqRecord( - Seq(seq[:-1]), id=identifier, name=identifier, description=description, + Seq(seq[:-1]), id=identifier, name=identifier, description=description ) record.annotations["PIR-type"] = pir_type if _pir_mol_type[pir_type]: diff --git a/Bio/SeqIO/SffIO.py b/Bio/SeqIO/SffIO.py index 38f75dfcdff..867728995f1 100644 --- a/Bio/SeqIO/SffIO.py +++ b/Bio/SeqIO/SffIO.py @@ -1044,7 +1044,7 @@ def iterate(self, handle): # the index_offset so we can skip extra handle.tell() calls: index_offset = 0 yield _sff_read_seq_record( - handle, number_of_flows_per_read, flow_chars, key_sequence, trim, + handle, number_of_flows_per_read, flow_chars, key_sequence, trim ) _check_eof(handle, index_offset, index_length) diff --git a/Bio/SeqIO/_index.py b/Bio/SeqIO/_index.py index 560b1c2cefe..52b3066d70e 100644 --- a/Bio/SeqIO/_index.py +++ b/Bio/SeqIO/_index.py @@ -141,7 +141,7 @@ def get(self, offset): handle = self._handle handle.seek(offset) return SeqIO.SffIO._sff_read_seq_record( - handle, self._flows_per_read, self._flow_chars, self._key_sequence, + handle, self._flows_per_read, self._flow_chars, self._key_sequence ) def get_raw(self, offset): diff --git a/Bio/codonalign/__init__.py b/Bio/codonalign/__init__.py index 7ed17005f0e..db3aa3ea472 100644 --- a/Bio/codonalign/__init__.py +++ b/Bio/codonalign/__init__.py @@ -246,7 +246,7 @@ def _get_aa_regex(codon_table, stop="*", unknown="X"): def _check_corr( - pro, nucl, gap_char, codon_table, complete_protein=False, anchor_len=10, + pro, nucl, gap_char, codon_table, complete_protein=False, anchor_len=10 ): """Check if the nucleotide can be translated into the protein (PRIVATE). @@ -571,7 +571,7 @@ def get_aa_from_codonre(re_aa): def _get_codon_rec( - pro, nucl, span_mode, gap_char, codon_table, complete_protein=False, max_score=10, + pro, nucl, span_mode, gap_char, codon_table, complete_protein=False, max_score=10 ): """Generate codon alignment based on regular re match (PRIVATE). diff --git a/Bio/codonalign/codonalignment.py b/Bio/codonalign/codonalignment.py index f5570b6f1b6..38cf0e1c965 100644 --- a/Bio/codonalign/codonalignment.py +++ b/Bio/codonalign/codonalignment.py @@ -65,7 +65,7 @@ def __str__(self): rows = len(self._records) lines = [ "CodonAlignment with %i rows and %i columns (%i codons)" - % (rows, self.get_alignment_length(), self.get_aln_length(),) + % (rows, self.get_alignment_length(), self.get_aln_length()) ] if rows <= 60: diff --git a/Bio/codonalign/codonseq.py b/Bio/codonalign/codonseq.py index 725355a10bf..7f1dc57b34b 100644 --- a/Bio/codonalign/codonseq.py +++ b/Bio/codonalign/codonseq.py @@ -276,9 +276,7 @@ def _get_codon_list(codonseq): return codon_lst -def cal_dn_ds( - codon_seq1, codon_seq2, method="NG86", codon_table=None, k=1, cfreq=None, -): +def cal_dn_ds(codon_seq1, codon_seq2, method="NG86", codon_table=None, k=1, cfreq=None): """Calculate dN and dS of the given two sequences. Available methods: diff --git a/BioSQL/BioSeq.py b/BioSQL/BioSeq.py index b9b105b342e..7555890262e 100644 --- a/BioSQL/BioSeq.py +++ b/BioSQL/BioSeq.py @@ -321,7 +321,7 @@ def _retrieve_annotations(adaptor, primary_id, taxon_id): def _retrieve_alphabet(adaptor, primary_id): results = adaptor.execute_and_fetchall( - "SELECT alphabet FROM biosequence WHERE bioentry_id = %s", (primary_id,), + "SELECT alphabet FROM biosequence WHERE bioentry_id = %s", (primary_id,) ) assert len(results) == 1 alphabets = results[0] diff --git a/Scripts/PDB/hsexpo.py b/Scripts/PDB/hsexpo.py index 3bf786cd7a9..5a075d5975f 100644 --- a/Scripts/PDB/hsexpo.py +++ b/Scripts/PDB/hsexpo.py @@ -43,7 +43,7 @@ default="HSEb", ) ap.add_argument( - "-o", "--out", dest="outfile", help="output to PDB file (B factor=exposure)", + "-o", "--out", dest="outfile", help="output to PDB file (B factor=exposure)" ) ap.add_argument( "-r", diff --git a/Tests/common_BioSQL.py b/Tests/common_BioSQL.py index b7786cfd368..e4c1b9d6aa5 100644 --- a/Tests/common_BioSQL.py +++ b/Tests/common_BioSQL.py @@ -495,12 +495,7 @@ def test_convert(self): def test_addition(self): """Check can add Seq objects from BioSQL together.""" test_seq = self.item.seq - for other in [ - Seq("ACGT"), - MutableSeq("ACGT"), - "ACGT", - test_seq, - ]: + for other in [Seq("ACGT"), MutableSeq("ACGT"), "ACGT", test_seq]: test = test_seq + other self.assertEqual(test, str(test_seq) + str(other)) self.assertIsInstance(test, Seq) diff --git a/Tests/pairwise2_testCases.py b/Tests/pairwise2_testCases.py index 629e215c342..48f0cb586f1 100755 --- a/Tests/pairwise2_testCases.py +++ b/Tests/pairwise2_testCases.py @@ -855,10 +855,7 @@ def test_clean_alignments(self): ("ACCGT", "AC-G-", 3.0, 0, 4), ("ACCGT", "A-CG-", 3.0, 0, 4), ] - expected = [ - ("ACCGT", "AC-G-", 3.0, 0, 4), - ("ACCGT", "A-CG-", 3.0, 0, 4), - ] + expected = [("ACCGT", "AC-G-", 3.0, 0, 4), ("ACCGT", "A-CG-", 3.0, 0, 4)] result = pairwise2._clean_alignments(alns) self.assertEqual(expected, result) diff --git a/Tests/test_AlignIO.py b/Tests/test_AlignIO.py index 4cde4234c35..87cb366e62a 100644 --- a/Tests/test_AlignIO.py +++ b/Tests/test_AlignIO.py @@ -451,7 +451,7 @@ def test_reading_alignments_nexus2(self): self.check_alignment_rows( alignment, [ - ("Aegotheles", "AAAAAGGCATTGTGGTGGGAAT",), + ("Aegotheles", "AAAAAGGCATTGTGGTGGGAAT"), ("Aerodramus", "?????????TTGTGGTGGGAAT"), ], ) diff --git a/Tests/test_Align_emboss.py b/Tests/test_Align_emboss.py index f75e464466e..c4a5056a669 100644 --- a/Tests/test_Align_emboss.py +++ b/Tests/test_Align_emboss.py @@ -960,21 +960,17 @@ def test_local_water2(self): repr(alignment.sequences[0].seq), "Seq({78: 'CGTTTGAGTCTGGGATG'}, length=95)", ) - self.assertEqual( - alignment.sequences[0].seq[78:95], "CGTTTGAGTCTGGGATG", - ) - self.assertEqual( - alignment.sequences[1].seq[0:18], "CGTTTGAGTACTGGGATG", - ) + self.assertEqual(alignment.sequences[0].seq[78:95], "CGTTTGAGTCTGGGATG") + self.assertEqual(alignment.sequences[1].seq[0:18], "CGTTTGAGTACTGGGATG") self.assertTrue( numpy.array_equal( - alignment.coordinates, numpy.array([[78, 87, 87, 95], [0, 9, 10, 18]]), + alignment.coordinates, numpy.array([[78, 87, 87, 95], [0, 9, 10, 18]]) ) ) self.assertEqual(alignment[0], "CGTTTGAGT-CTGGGATG") self.assertEqual(alignment[1], "CGTTTGAGTACTGGGATG") self.assertEqual( - alignment.column_annotations["emboss_consensus"], "||||||||| ||||||||", + alignment.column_annotations["emboss_consensus"], "||||||||| ||||||||" ) diff --git a/Tests/test_BioSQL_sqlite3.py b/Tests/test_BioSQL_sqlite3.py index 45871e59662..77fb76337f8 100644 --- a/Tests/test_BioSQL_sqlite3.py +++ b/Tests/test_BioSQL_sqlite3.py @@ -16,11 +16,7 @@ from common_BioSQL import * # noqa: F403 # Import these explicitly to avoid flake8 F405 below: -from common_BioSQL import ( - load_biosql_ini, - check_config, - temp_db_filename, -) +from common_BioSQL import load_biosql_ini, check_config, temp_db_filename # Constants for the database driver DBDRIVER = "sqlite3" diff --git a/Tests/test_CAPS.py b/Tests/test_CAPS.py index 9cf67f64d93..1d6d43c33af 100644 --- a/Tests/test_CAPS.py +++ b/Tests/test_CAPS.py @@ -20,7 +20,7 @@ def createAlignment(sequences): ( SeqRecord(Seq(s), id="sequence%i" % (i + 1)) for (i, s) in enumerate(sequences) - ), + ) ) diff --git a/Tests/test_Emboss.py b/Tests/test_Emboss.py index 0102fda6a3e..30df45c4855 100644 --- a/Tests/test_Emboss.py +++ b/Tests/test_Emboss.py @@ -305,7 +305,7 @@ def test_ig(self): # NOTE - EMBOSS considers "genbank" to be for nucleotides only, # and will turn "X" into "N" for GenBank output. self.check_SeqIO_to_EMBOSS( - "IntelliGenetics/VIF_mase-pro.txt", "ig", skip_formats=["genbank", "embl"], + "IntelliGenetics/VIF_mase-pro.txt", "ig", skip_formats=["genbank", "embl"] ) # TODO - What does a % in an ig sequence mean? # e.g. "IntelliGenetics/vpu_nucaligned.txt" @@ -457,13 +457,13 @@ def pairwise_alignment_check(self, query_seq, targets, alignments, local=True): # Local alignment self.assertIn(str(alignment[0].seq).replace("-", ""), query_seq) self.assertIn( - str(alignment[1].seq).replace("-", "").upper(), target.seq.upper(), + str(alignment[1].seq).replace("-", "").upper(), target.seq.upper() ) else: # Global alignment self.assertEqual(query_seq, str(alignment[0].seq).replace("-", "")) self.assertEqual( - target.seq.upper(), str(alignment[1].seq).replace("-", "").upper(), + target.seq.upper(), str(alignment[1].seq).replace("-", "").upper() ) return True diff --git a/Tests/test_Entrez.py b/Tests/test_Entrez.py index 5fd03fed0cb..59cff8c86c4 100644 --- a/Tests/test_Entrez.py +++ b/Tests/test_Entrez.py @@ -144,7 +144,7 @@ def test_construct_cgi_ecitmatch(self): self.assertEqual(get_base_url(parsed), URL_HEAD + "ecitmatch.cgi") query.pop("bdata") # TODO self.assertDictEqual( - query, {"retmode": ["xml"], "db": [variables["db"]], **QUERY_DEFAULTS}, + query, {"retmode": ["xml"], "db": [variables["db"]], **QUERY_DEFAULTS} ) def test_construct_cgi_einfo(self): @@ -170,7 +170,7 @@ def test_construct_cgi_epost1(self): self.assertEqual(result_url, URL_HEAD + "epost.fcgi") # Params in POST data self.assertDictEqual( - query, {"db": [variables["db"]], "id": [variables["id"]], **QUERY_DEFAULTS}, + query, {"db": [variables["db"]], "id": [variables["id"]], **QUERY_DEFAULTS} ) def test_construct_cgi_epost2(self): @@ -185,9 +185,7 @@ def test_construct_cgi_epost2(self): self.assertEqual(result_url, URL_HEAD + "epost.fcgi") # Params in POST data # Compare IDs up to reordering: self.assertCountEqual(query.pop("id"), variables["id"]) - self.assertDictEqual( - query, {"db": [variables["db"]], **QUERY_DEFAULTS}, - ) + self.assertDictEqual(query, {"db": [variables["db"]], **QUERY_DEFAULTS}) def test_construct_cgi_elink1(self): variables = { @@ -320,10 +318,10 @@ def test_custom_directory(self): # Confirm that the two temp directories are named what we want. self.assertEqual( - handler.local_dtd_dir, os.path.join(tmpdir, "Bio", "Entrez", "DTDs"), + handler.local_dtd_dir, os.path.join(tmpdir, "Bio", "Entrez", "DTDs") ) self.assertEqual( - handler.local_xsd_dir, os.path.join(tmpdir, "Bio", "Entrez", "XSDs"), + handler.local_xsd_dir, os.path.join(tmpdir, "Bio", "Entrez", "XSDs") ) # And that they were created. diff --git a/Tests/test_GenBank.py b/Tests/test_GenBank.py index f4715a15004..96722c211c4 100644 --- a/Tests/test_GenBank.py +++ b/Tests/test_GenBank.py @@ -7512,7 +7512,7 @@ def test_implicit_orign_wrap_extract_and_translate(self): "MPYKTQGCLGKGATPTPSSRGI*", ) self.assertEqual( - seq_features[2].extract(seq_record).seq.translate(), "MPRLEGVGVAPFPRQPWVL*", + seq_features[2].extract(seq_record).seq.translate(), "MPRLEGVGVAPFPRQPWVL*" ) def test_fuzzy_origin_wrap(self): diff --git a/Tests/test_GenomeDiagram.py b/Tests/test_GenomeDiagram.py index 377e0c49bfb..01d716681fb 100644 --- a/Tests/test_GenomeDiagram.py +++ b/Tests/test_GenomeDiagram.py @@ -303,7 +303,7 @@ def test_slicing(self): self.assertEqual( gd[4:16], - [(5, 15), (10, 20),], # noqa 231 + [(5, 15), (10, 20)], # noqa 231 "Unable to insert and retrieve points correctly", ) diff --git a/Tests/test_HMMGeneral.py b/Tests/test_HMMGeneral.py index 08c132eb090..74d8d550d89 100644 --- a/Tests/test_HMMGeneral.py +++ b/Tests/test_HMMGeneral.py @@ -122,9 +122,7 @@ def test_set_equal_probabilities(self): self.mm_builder.allow_transition("2", "1", 0.95) self.mm_builder.set_equal_probabilities() - self.assertEqual( - self.mm_builder.initial_prob, {"1": 0.5, "2": 0.5}, - ) + self.assertEqual(self.mm_builder.initial_prob, {"1": 0.5, "2": 0.5}) self.assertEqual( self.mm_builder.transition_prob, {("1", "2"): 0.5, ("2", "1"): 0.5} ) diff --git a/Tests/test_NCBI_qblast.py b/Tests/test_NCBI_qblast.py index b688cb665fa..baaa77ca458 100644 --- a/Tests/test_NCBI_qblast.py +++ b/Tests/test_NCBI_qblast.py @@ -220,7 +220,7 @@ def test_discomegablast(self): CTTGTGTGCCACTGGTAAATCCACCCCCCCTAAGCCTCTAATAGGGAGACCTTAG""", 0.0000001, None, - {"template_type": 0, "template_length": 18, "megablast": "on",}, # noqa 231 + {"template_type": 0, "template_length": 18, "megablast": "on"}, # noqa 231 ["XM_635681.1", "XM_008496783.1"], ) diff --git a/Tests/test_NaiveBayes.py b/Tests/test_NaiveBayes.py index 93212615fdb..77c9544814d 100644 --- a/Tests/test_NaiveBayes.py +++ b/Tests/test_NaiveBayes.py @@ -47,18 +47,7 @@ def test_car_data(self): ["Red", "Sports", "Imported"], ] - ycar = [ - "Yes", - "No", - "Yes", - "No", - "Yes", - "No", - "Yes", - "No", - "No", - "Yes", - ] + ycar = ["Yes", "No", "Yes", "No", "Yes", "No", "Yes", "No", "No", "Yes"] carmodel = NaiveBayes.train(xcar, ycar) self.assertEqual( diff --git a/Tests/test_PDB_Polypeptide.py b/Tests/test_PDB_Polypeptide.py index 2551fbe51eb..ea7133fba1d 100644 --- a/Tests/test_PDB_Polypeptide.py +++ b/Tests/test_PDB_Polypeptide.py @@ -66,7 +66,7 @@ def test_ppbuilder_real_nonstd(self): self.assertIsInstance(s, Seq) # Here non-standard MSE are shown as M self.assertEqual( - "MDIRQGPKEPFRDYVDRFYKTLRAEQASQEVKNWMTETLLVQNANPDCKTILKALGPGATLEEMMTACQG", s, + "MDIRQGPKEPFRDYVDRFYKTLRAEQASQEVKNWMTETLLVQNANPDCKTILKALGPGATLEEMMTACQG", s ) def test_ppbuilder_torsion(self): @@ -164,7 +164,7 @@ def test_cappbuilder_real_nonstd(self): self.assertIsInstance(s, Seq) # Here non-standard MSE are shown as M self.assertEqual( - "MDIRQGPKEPFRDYVDRFYKTLRAEQASQEVKNWMTETLLVQNANPDCKTILKALGPGATLEEMMTACQG", s, + "MDIRQGPKEPFRDYVDRFYKTLRAEQASQEVKNWMTETLLVQNANPDCKTILKALGPGATLEEMMTACQG", s ) def test_cappbuilder_tau(self): diff --git a/Tests/test_PDB_parse_pdb_header.py b/Tests/test_PDB_parse_pdb_header.py index f970b434972..3445d08be99 100644 --- a/Tests/test_PDB_parse_pdb_header.py +++ b/Tests/test_PDB_parse_pdb_header.py @@ -136,13 +136,7 @@ def test_parse_remark_465(self): info = _parse_remark_465("1 DG B 9") self.assertEqual( info, - { - "model": 1, - "res_name": "DG", - "chain": "B", - "ssseq": 9, - "insertion": None, - }, + {"model": 1, "res_name": "DG", "chain": "B", "ssseq": 9, "insertion": None}, ) def test_parse_header_line(self): diff --git a/Tests/test_PhyloXML.py b/Tests/test_PhyloXML.py index 0d9be3d1410..1c02cd82b7f 100644 --- a/Tests/test_PhyloXML.py +++ b/Tests/test_PhyloXML.py @@ -102,27 +102,27 @@ class ParseTests(unittest.TestCase): test_parse_dollo = _test_parse_factory(EX_DOLLO, 1) # lvl-2 clades, sub-clade counts, lvl-3 clades - test_shape_apaf = _test_shape_factory(EX_APAF, (((2, (2, 2)), (2, (2, 2)),),),) - test_shape_bcl2 = _test_shape_factory(EX_BCL2, (((2, (2, 2)), (2, (2, 2)),),),) + test_shape_apaf = _test_shape_factory(EX_APAF, (((2, (2, 2)), (2, (2, 2))),)) + test_shape_bcl2 = _test_shape_factory(EX_BCL2, (((2, (2, 2)), (2, (2, 2))),)) test_shape_phylo = _test_shape_factory( EX_PHYLO, ( - ((2, (0, 0)), (0, ()),), - ((2, (0, 0)), (0, ()),), - ((2, (0, 0)), (0, ()),), - ((2, (0, 0)), (0, ()),), - ((2, (0, 0)), (0, ()),), - ((2, (0, 0)), (0, ()),), - ((2, (0, 0)), (0, ()),), - ((2, (0, 0)), (0, ()),), - ((2, (0, 0)), (0, ()),), - ((0, ()), (2, (0, 0)),), - ((3, (0, 0, 0)), (0, ()),), - ((2, (0, 0)), (0, ()),), - ((2, (0, 0)), (0, ()),), + ((2, (0, 0)), (0, ())), + ((2, (0, 0)), (0, ())), + ((2, (0, 0)), (0, ())), + ((2, (0, 0)), (0, ())), + ((2, (0, 0)), (0, ())), + ((2, (0, 0)), (0, ())), + ((2, (0, 0)), (0, ())), + ((2, (0, 0)), (0, ())), + ((2, (0, 0)), (0, ())), + ((0, ()), (2, (0, 0))), + ((3, (0, 0, 0)), (0, ())), + ((2, (0, 0)), (0, ())), + ((2, (0, 0)), (0, ())), ), ) - test_shape_dollo = _test_shape_factory(EX_DOLLO, (((2, (2, 2)), (2, (2, 2)),),),) + test_shape_dollo = _test_shape_factory(EX_DOLLO, (((2, (2, 2)), (2, (2, 2))),)) class TreeTests(unittest.TestCase): diff --git a/Tests/test_Phylo_matplotlib.py b/Tests/test_Phylo_matplotlib.py index aa9ec1632d4..14007cb4c39 100644 --- a/Tests/test_Phylo_matplotlib.py +++ b/Tests/test_Phylo_matplotlib.py @@ -64,14 +64,8 @@ def test_draw_with_label_colors_dict(self): pyplot.ioff() # Turn off interactive display dollo = Phylo.read(EX_DOLLO, "phyloxml") apaf = Phylo.read(EX_APAF, "phyloxml") - label_colors_dollo = { - "f_50": "red", - "f_34": "blue", - } - label_colors_apaf = { - "22_MOUSE": "red", - "18_NEMVE": "blue", - } + label_colors_dollo = {"f_50": "red", "f_34": "blue"} + label_colors_apaf = {"22_MOUSE": "red", "18_NEMVE": "blue"} Phylo.draw(dollo, label_colors=label_colors_dollo, do_show=False) Phylo.draw(apaf, label_colors=label_colors_apaf, do_show=False) diff --git a/Tests/test_SCOP_Raf.py b/Tests/test_SCOP_Raf.py index 7b8b8f747fa..52de94044a0 100644 --- a/Tests/test_SCOP_Raf.py +++ b/Tests/test_SCOP_Raf.py @@ -78,9 +78,7 @@ def testSeqMapIndex(self): self.assertEqual(r.flags, "111011") r = index.getSeqMap("103m 1-10") - self.assertEqual( - r.pdbid, "103m", - ) + self.assertEqual(r.pdbid, "103m") self.assertEqual(len(r.res), 10) self.assertEqual(r.pdb_datestamp, "010301") self.assertEqual(r.flags, "111011") diff --git a/Tests/test_SearchIO_blast_tab.py b/Tests/test_SearchIO_blast_tab.py index 5e1c66d3a08..e800263360b 100644 --- a/Tests/test_SearchIO_blast_tab.py +++ b/Tests/test_SearchIO_blast_tab.py @@ -771,11 +771,10 @@ def test_tab_2226_tblastn_011(self): self.assertEqual(1e-04, hsp.evalue) self.assertEqual(31.6, hsp.bitscore) self.assertEqual( - "GLADTHTIEVTVDNEPVSLDITEESTSDLDKFNSG--------DKVTITYEKNDEGQLL", - hsp.query.seq, + "GLADTHTIEVTVDNEPVSLDITEESTSDLDKFNSG--------DKVTITYEKNDEGQLL", hsp.query.seq ) self.assertEqual( - "GLVPDHTLILPVGHYQSMLDLTEEVQTELDQFKSALRKYYLSKGKTCVIYERNFRTQHL", hsp.hit.seq, + "GLVPDHTLILPVGHYQSMLDLTEEVQTELDQFKSALRKYYLSKGKTCVIYERNFRTQHL", hsp.hit.seq ) self.assertEqual(70.0, hsp.bitscore_raw) self.assertEqual(20, hsp.ident_num) @@ -969,11 +968,10 @@ def test_tab_2226_tblastn_013(self): self.assertEqual(1e-04, hsp.evalue) self.assertEqual(31.6, hsp.bitscore) self.assertEqual( - "GLADTHTIEVTVDNEPVSLDITEESTSDLDKFNSG--------DKVTITYEKNDEGQLL", - hsp.query.seq, + "GLADTHTIEVTVDNEPVSLDITEESTSDLDKFNSG--------DKVTITYEKNDEGQLL", hsp.query.seq ) self.assertEqual( - "GLVPDHTLILPVGHYQSMLDLTEEVQTELDQFKSALRKYYLSKGKTCVIYERNFRTQHL", hsp.hit.seq, + "GLVPDHTLILPVGHYQSMLDLTEEVQTELDQFKSALRKYYLSKGKTCVIYERNFRTQHL", hsp.hit.seq ) # check if we've finished iteration over qresults diff --git a/Tests/test_SearchIO_exonerate.py b/Tests/test_SearchIO_exonerate.py index eb86fdb9fdf..df08a283c7b 100644 --- a/Tests/test_SearchIO_exonerate.py +++ b/Tests/test_SearchIO_exonerate.py @@ -2246,7 +2246,7 @@ def test_exn_22_m_protein2genome(self): self.assertEqual("AAT", hsp.aln_annotation_all[0]["hit_annotation"][0]) self.assertEqual("TT", hsp.aln_annotation_all[0]["hit_annotation"][-1]) self.assertEqual( - "XELLEQKDAQNKTTTDFLLCSLKSLLSEITKYRAKNSDDERILAFLDDLQE", hsp[-1].query.seq, + "XELLEQKDAQNKTTTDFLLCSLKSLLSEITKYRAKNSDDERILAFLDDLQE", hsp[-1].query.seq ) self.assertEqual( "XNKILNRDPQFMSNSSFHQCVSLDSINTIEKDEEKNSDDDAGLQAATDARE", hsp[-1].hit.seq diff --git a/Tests/test_SearchIO_fasta_m10.py b/Tests/test_SearchIO_fasta_m10.py index dec5c60eda3..86a999eb137 100644 --- a/Tests/test_SearchIO_fasta_m10.py +++ b/Tests/test_SearchIO_fasta_m10.py @@ -330,7 +330,7 @@ def test_output003(self): self.assertEqual(86, hsp.query_start) self.assertEqual(141, hsp.query_end) self.assertEqual( - "ISISNNKDQYEELQKEQGERDLKTVDQLVRIAAAGGGLRLSASTKTVDQLVRIAA", hsp.query.seq, + "ISISNNKDQYEELQKEQGERDLKTVDQLVRIAAAGGGLRLSASTKTVDQLVRIAA", hsp.query.seq ) self.assertEqual(17, hsp.hit_start) self.assertEqual(69, hsp.hit_end) diff --git a/Tests/test_SearchIO_hmmer3_text.py b/Tests/test_SearchIO_hmmer3_text.py index ac1b4fc37af..dc806fd2c95 100644 --- a/Tests/test_SearchIO_hmmer3_text.py +++ b/Tests/test_SearchIO_hmmer3_text.py @@ -549,10 +549,10 @@ def test_30_hmmscan_001(self): hsp.aln_annotation["CS"], ) self.assertEqual( - "rrkRttftkeqleeLeelFeknrypsaeereeLAkklgLterqVkvWFqNrRakekk", hsp.hit.seq, + "rrkRttftkeqleeLeelFeknrypsaeereeLAkklgLterqVkvWFqNrRakekk", hsp.hit.seq ) self.assertEqual( - "KRKRTSIENRVRWSLETMFLKCPKPSLQQITHIANQLGLEKDVVRVWFCNRRQKGKR", hsp.query.seq, + "KRKRTSIENRVRWSLETMFLKCPKPSLQQITHIANQLGLEKDVVRVWFCNRRQKGKR", hsp.query.seq ) self.assertEqual( "79****************************************************997", diff --git a/Tests/test_SeqIO.py b/Tests/test_SeqIO.py index c3146f34acf..549a7a94d94 100644 --- a/Tests/test_SeqIO.py +++ b/Tests/test_SeqIO.py @@ -560,7 +560,7 @@ def perform_test( for acc in accs: self.assertTrue(acc, "Bad accession in annotations: %r" % acc) self.assertEqual( - acc, acc.strip(), "Bad accession in annotations: %r" % acc, + acc, acc.strip(), "Bad accession in annotations: %r" % acc ) self.assertEqual( len(set(accs)), @@ -570,7 +570,7 @@ def perform_test( for ref in record.dbxrefs: self.assertTrue(ref, "Bad cross reference in dbxrefs: %r" % ref) self.assertEqual( - ref, ref.strip(), "Bad cross reference in dbxrefs: %r" % ref, + ref, ref.strip(), "Bad cross reference in dbxrefs: %r" % ref ) self.assertEqual( len(set(record.dbxrefs)), @@ -3743,10 +3743,7 @@ def test_stockholm2(self): "363253|refseq_protein.50.proto_past_mitoc_micro_vira|gi|94986659|ref|YP_594592.1|awsonia_intraceuaris_PHE/MN1-00", ] lengths = [43, 43, 43, 43] - molecule_types = { - "seqxml": "protein", - "nexus": "protein", - } + molecule_types = {"seqxml": "protein", "nexus": "protein"} alignment = """\ MMMEEE alignment column 0 TQIVVV alignment column 1 @@ -4359,9 +4356,7 @@ def test_phd4(self): names = ["EBE03TV04IHLTF.77-243"] lengths = [30] alignment = None - messages = { - "sff": "Missing SFF flow information", - } + messages = {"sff": "Missing SFF flow information"} self.perform_test( "phd", False, @@ -5063,9 +5058,7 @@ def test_fastq4(self): "nexus": "DNA", } alignment = None - messages = { - "sff": "Missing SFF flow information", - } + messages = {"sff": "Missing SFF flow information"} self.perform_test( "fastq", False, @@ -5093,9 +5086,7 @@ def test_fastq5(self): "nexus": "DNA", } alignment = None - messages = { - "sff": "Missing SFF flow information", - } + messages = {"sff": "Missing SFF flow information"} self.perform_test( "fastq", False, @@ -5123,9 +5114,7 @@ def test_fastq_illumina1(self): "nexus": "DNA", } alignment = None - messages = { - "sff": "Missing SFF flow information", - } + messages = {"sff": "Missing SFF flow information"} self.perform_test( "fastq-illumina", False, @@ -5153,9 +5142,7 @@ def test_fastq_solexa1(self): "nexus": "DNA", } alignment = None - messages = { - "sff": "Missing SFF flow information", - } + messages = {"sff": "Missing SFF flow information"} self.perform_test( "fastq-solexa", False, @@ -5357,9 +5344,7 @@ def test_abi2(self): names = ["3100"] lengths = [795] alignment = None - messages = { - "sff": "Missing SFF flow information", - } + messages = {"sff": "Missing SFF flow information"} self.perform_test( "abi", False, diff --git a/Tests/test_SeqIO_TwoBitIO.py b/Tests/test_SeqIO_TwoBitIO.py index 5cd08255a7d..262afea0c24 100644 --- a/Tests/test_SeqIO_TwoBitIO.py +++ b/Tests/test_SeqIO_TwoBitIO.py @@ -362,7 +362,7 @@ def test_find(self): self.seq1_twobit.find("CT", 75), self.seq1_fasta.find("CT", 75) ) self.assertEqual( - self.seq1_twobit.find("CT", 75, 100), self.seq1_fasta.find("CT", 75, 100), + self.seq1_twobit.find("CT", 75, 100), self.seq1_fasta.find("CT", 75, 100) ) self.assertEqual( self.seq1_twobit.find("CT", None, 100), diff --git a/Tests/test_SeqIO_index.py b/Tests/test_SeqIO_index.py index 2a0bd18d76e..c46e91ef1bf 100644 --- a/Tests/test_SeqIO_index.py +++ b/Tests/test_SeqIO_index.py @@ -590,13 +590,13 @@ def get_raw_check(self, filename, fmt, comp): rec_dict = SeqIO.index(filename, fmt, key_function=str.lower) if sqlite3: rec_dict_db = SeqIO.index_db( - ":memory:", filename, fmt, key_function=str.lower, + ":memory:", filename, fmt, key_function=str.lower ) else: rec_dict = SeqIO.index(filename, fmt, key_function=str.lower) if sqlite3: rec_dict_db = SeqIO.index_db( - ":memory:", filename, fmt, key_function=str.lower, + ":memory:", filename, fmt, key_function=str.lower ) self.assertCountEqual(id_list, rec_dict.keys(), msg=msg) diff --git a/Tests/test_SeqIO_online.py b/Tests/test_SeqIO_online.py index f74ca22c8a9..43a096804af 100644 --- a/Tests/test_SeqIO_online.py +++ b/Tests/test_SeqIO_online.py @@ -59,10 +59,7 @@ def simple(self, database, formats, entry, length, checksum): record = SeqIO.read(handle, f) handle.close() # NCBI still takes GI on input, but phasing it out in output - gi_to_acc = { - "6273291": "AF191665.1", - "16130152": "NP_416719.1", - } + gi_to_acc = {"6273291": "AF191665.1", "16130152": "NP_416719.1"} if entry in gi_to_acc: entry = gi_to_acc[entry] self.assertTrue( diff --git a/Tests/test_Seq_objs.py b/Tests/test_Seq_objs.py index 921a3e210cd..a368d29ff23 100644 --- a/Tests/test_Seq_objs.py +++ b/Tests/test_Seq_objs.py @@ -1065,9 +1065,7 @@ def test_join_MutableSeq_TypeError_iter(self): def test_join_Seq(self): """Checks if Seq join correctly concatenates sequence with the spacer.""" spacer = Seq("NNNNN") - self.assertEqual( - "N" * 15, spacer.join([Seq("NNNNN"), Seq("NNNNN")]), - ) + self.assertEqual("N" * 15, spacer.join([Seq("NNNNN"), Seq("NNNNN")])) spacer1 = Seq("") spacers = [spacer1, Seq("NNNNN"), Seq("GGG")] @@ -1128,11 +1126,9 @@ def test_join_MutableSeq_mixed(self): """Check MutableSeq objects can be joined.""" spacer = MutableSeq("NNNNN") self.assertEqual( - "N" * 15, spacer.join([MutableSeq("NNNNN"), MutableSeq("NNNNN")]), - ) - self.assertRaises( - TypeError, spacer.join([Seq("NNNNN"), MutableSeq("NNNNN")]), + "N" * 15, spacer.join([MutableSeq("NNNNN"), MutableSeq("NNNNN")]) ) + self.assertRaises(TypeError, spacer.join([Seq("NNNNN"), MutableSeq("NNNNN")])) def test_join_Seq_with_file(self): """Checks if Seq join correctly concatenates sequence from a file with the spacer.""" @@ -1185,11 +1181,7 @@ def test_join_MutableSeq(self): # Only expect it to take Seq objects and/or strings in an iterable! spacer1 = MutableSeq("") - spacers = [ - spacer1, - MutableSeq("NNNNN"), - MutableSeq("GGG"), - ] + spacers = [spacer1, MutableSeq("NNNNN"), MutableSeq("GGG")] example_strings = ["ATG", "ATG", "ATG", "ATG"] example_strings_seqs = ["ATG", "ATG", Seq("ATG"), "ATG"] @@ -1931,7 +1923,7 @@ def test_addition(self): "Seq({3: 'KLM', 11: 'XYZ', 17: 'PQRST', 25: 'HIJ'}, length=30)", ) self.assertEqual( - repr(p1 + t), "Seq({3: 'KLM', 11: 'XYZ', 17: 'ACGTacgtNNNNnn'}, length=31)", + repr(p1 + t), "Seq({3: 'KLM', 11: 'XYZ', 17: 'ACGTacgtNNNNnn'}, length=31)" ) self.assertEqual( repr(p2 + s1), "Seq({0: 'PQRST', 8: 'HIJ', 13: 'ABCD'}, length=17)" @@ -1950,8 +1942,7 @@ def test_addition(self): "Seq({0: 'PQRST', 8: 'HIJ', 13: 'PQRST', 21: 'HIJ'}, length=26)", ) self.assertEqual( - repr(p2 + t), - "Seq({0: 'PQRST', 8: 'HIJ', 13: 'ACGTacgtNNNNnn'}, length=27)", + repr(p2 + t), "Seq({0: 'PQRST', 8: 'HIJ', 13: 'ACGTacgtNNNNnn'}, length=27)" ) self.assertEqual(t + s1, Seq("ACGTacgtNNNNnnABCD")) self.assertEqual(t + s2, Seq("ACGTacgtNNNNnnEFG")) diff --git a/Tests/test_SwissProt.py b/Tests/test_SwissProt.py index dcee284ff03..6d461c481c7 100644 --- a/Tests/test_SwissProt.py +++ b/Tests/test_SwissProt.py @@ -3323,7 +3323,7 @@ def test_P60137(self): "RecName: Full=Photosystem II reaction center protein L {ECO:0000255|HAMAP-Rule:MF_01317}; Short=PSII-L {ECO:0000255|HAMAP-Rule:MF_01317};", ) self.assertEqual( - repr(seq_record.seq), "Seq('MTQSNPNEQNVELNRTSLYWGLLLIFVLAVLFSNYFFN')", + repr(seq_record.seq), "Seq('MTQSNPNEQNVELNRTSLYWGLLLIFVLAVLFSNYFFN')" ) with open(datafile) as test_handle: diff --git a/Tests/test_TogoWS.py b/Tests/test_TogoWS.py index 4a6182494bd..98e024a1d71 100644 --- a/Tests/test_TogoWS.py +++ b/Tests/test_TogoWS.py @@ -163,7 +163,7 @@ def test_pubmed_16381885(self): data = Medline.read(handle) handle.close() self.assertEqual( - data["TI"], "From genomics to chemical genomics: new developments in KEGG.", + data["TI"], "From genomics to chemical genomics: new developments in KEGG." ) self.assertEqual( data["AU"], diff --git a/Tests/test_UniProt_GOA.py b/Tests/test_UniProt_GOA.py index 1a84aa48681..610814d7ba8 100644 --- a/Tests/test_UniProt_GOA.py +++ b/Tests/test_UniProt_GOA.py @@ -120,9 +120,7 @@ def test_gpi_iterator_one_two(self): self.assertEqual(recs[0]["DB"], "UniProtKB") self.assertEqual(recs[0]["DB_Object_ID"], "A0A024R1R8") self.assertEqual(recs[0]["DB_Object_Symbol"], "hCG_2014768") - self.assertEqual( - recs[0]["DB_Object_Name"], ["HCG2014768, isoform CRA_a"], - ) + self.assertEqual(recs[0]["DB_Object_Name"], ["HCG2014768, isoform CRA_a"]) self.assertEqual(recs[0]["DB_Object_Synonym"], ["hCG_2014768"]) self.assertEqual(recs[0]["DB_Object_Type"], "protein") self.assertEqual(recs[0]["Taxon"], "taxon:9606") diff --git a/Tests/test_cellosaurus.py b/Tests/test_cellosaurus.py index 1fabc115f9b..d6fdbb2ac0d 100644 --- a/Tests/test_cellosaurus.py +++ b/Tests/test_cellosaurus.py @@ -23,7 +23,7 @@ def test_read(self): self.assertEqual(record["DR"][2], ("IHW", "IHW9326")) self.assertEqual(record["DR"][3], ("IMGT/HLA", "10074")) self.assertEqual( - record["WW"][0], "http://bioinformatics.hsanmartino.it/ecbr/cl326.html", + record["WW"][0], "http://bioinformatics.hsanmartino.it/ecbr/cl326.html" ) self.assertEqual( record["CC"][0], diff --git a/Tests/test_codonalign.py b/Tests/test_codonalign.py index e0ae3a7c3c9..a56b8b68312 100644 --- a/Tests/test_codonalign.py +++ b/Tests/test_codonalign.py @@ -184,14 +184,12 @@ def setUp(self): # Test set 1 seq1 = SeqRecord( Seq( - "TCAGGGACTGCGAGAACCAAGCTACTGCTGCTGCTGGCTGCGCTCTGCGCCGCAGGTGGGGCGCTGGAG", + "TCAGGGACTGCGAGAACCAAGCTACTGCTGCTGCTGGCTGCGCTCTGCGCCGCAGGTGGGGCGCTGGAG" ), id="pro1", ) seq2 = SeqRecord( - Seq( - "TCAGGGACTTCGAGAACCAAGCGCTCCTGCTGCTGGCTGCGCTCGGCGCCGCAGGTGGAGCACTGGAG", - ), + Seq("TCAGGGACTTCGAGAACCAAGCGCTCCTGCTGCTGGCTGCGCTCGGCGCCGCAGGTGGAGCACTGGAG"), id="pro2", ) pro1 = SeqRecord(Seq("SGTARTKLLLLLAALCAAGGALE"), id="pro1") diff --git a/Tests/test_pairwise_aligner.py b/Tests/test_pairwise_aligner.py index c5abba6945f..28670d1fb67 100644 --- a/Tests/test_pairwise_aligner.py +++ b/Tests/test_pairwise_aligner.py @@ -2860,7 +2860,7 @@ def gap_score(i, n): numpy.array_equal( alignment.aligned, numpy.array([[[0, 2], [3, 4], [4, 6]], [[6, 4], [4, 3], [2, 0]]]), - ), + ) ) alignment = alignments[3] self.assertAlmostEqual(alignment.score, -8.0) @@ -3785,8 +3785,7 @@ def test_pickle_aligner_match_mismatch(self): pickled_aligner.query_internal_extend_gap_score, ) self.assertAlmostEqual( - aligner.query_left_open_gap_score, - pickled_aligner.query_left_open_gap_score, + aligner.query_left_open_gap_score, pickled_aligner.query_left_open_gap_score ) self.assertAlmostEqual( aligner.query_left_extend_gap_score, @@ -3870,8 +3869,7 @@ def test_pickle_aligner_substitution_matrix(self): pickled_aligner.query_internal_extend_gap_score, ) self.assertAlmostEqual( - aligner.query_left_open_gap_score, - pickled_aligner.query_left_open_gap_score, + aligner.query_left_open_gap_score, pickled_aligner.query_left_open_gap_score ) self.assertAlmostEqual( aligner.query_left_extend_gap_score, diff --git a/Tests/test_prodoc.py b/Tests/test_prodoc.py index 7a6943cd0c2..b98d2eff8cc 100644 --- a/Tests/test_prodoc.py +++ b/Tests/test_prodoc.py @@ -554,7 +554,7 @@ def test_read_pdoc00340(self): def test_read_pdoc00424(self): """Reading Prodoc record PDOC00424.""" - filename = os.path.join("Prosite", "Doc", "pdoc00424.txt",) + filename = os.path.join("Prosite", "Doc", "pdoc00424.txt") with open(filename) as handle: record = Prodoc.read(handle) @@ -761,7 +761,7 @@ def test_read_pdoc00472(self): def test_read_pdoc00640(self): """Reading Prodoc record PDOC00640.""" - filename = os.path.join("Prosite", "Doc", "pdoc00640.txt",) + filename = os.path.join("Prosite", "Doc", "pdoc00640.txt") with open(filename) as handle: record = Prodoc.read(handle) diff --git a/Tests/test_seq.py b/Tests/test_seq.py index 912b9c16ffb..1c978e60ec3 100644 --- a/Tests/test_seq.py +++ b/Tests/test_seq.py @@ -318,10 +318,7 @@ def setUp(self): Seq.Seq("U.CAG"), "UGCAU", ] - self.nuc = [ - Seq.Seq("ATCG"), - "UUUTTTACG", - ] + self.nuc = [Seq.Seq("ATCG"), "UUUTTTACG"] self.protein = [ Seq.Seq("ATCGPK"), Seq.Seq("atcGPK"), @@ -621,7 +618,7 @@ def test_first_nucleotide(self): def test_setting_slices(self): self.assertEqual( - Seq.MutableSeq("CAAA"), self.mutable_s[1:5], "Slice mutable seq", + Seq.MutableSeq("CAAA"), self.mutable_s[1:5], "Slice mutable seq" ) self.mutable_s[1:3] = "GAT" @@ -640,7 +637,7 @@ def test_setting_slices(self): if numpy is not None: one, three, five, seven = numpy.array([1, 3, 5, 7]) # numpy integers self.assertEqual( - Seq.MutableSeq("AATA"), self.mutable_s[one:five], "Slice mutable seq", + Seq.MutableSeq("AATA"), self.mutable_s[one:five], "Slice mutable seq" ) self.mutable_s[one:three] = "GAT"