From 1b2619fa41b29c31e2491b62ad6586713d4f727e Mon Sep 17 00:00:00 2001
From: Peter Cock
Date: Fri, 29 Nov 2019 11:47:13 +0000
Subject: [PATCH] Fix string concatenation style in Tests/
Some of these are recent regressions introduced by black
https://github.com/psf/black/issues/26
Others are long standing pre-existing style issues.
---
Tests/run_tests.py | 6 +++--
Tests/search_tests_common.py | 4 +--
Tests/seq_tests_common.py | 5 ++--
Tests/test_AlignIO_FastaIO.py | 50 +++++++++++++++++------------------
Tests/test_GenBank.py | 16 +++++------
Tests/test_GenomeDiagram.py | 42 ++++++++++++++++-------------
Tests/test_Nexus.py | 6 +++--
Tests/test_PDB_MMCIFParser.py | 11 ++++----
Tests/test_SeqIO_PdbIO.py | 14 +++++-----
Tests/test_SeqRecord.py | 6 +++--
Tests/test_Uniprot.py | 2 +-
Tests/test_cellosaurus.py | 10 ++++---
Tests/test_phenotype.py | 27 ++++++++++---------
Tests/test_seq.py | 12 ++++++---
14 files changed, 117 insertions(+), 94 deletions(-)
diff --git a/Tests/run_tests.py b/Tests/run_tests.py
index 15503f65d5a..7588b7d322c 100644
--- a/Tests/run_tests.py
+++ b/Tests/run_tests.py
@@ -181,8 +181,10 @@ def _have_bug17666():
return False
import gzip
# Would like to use byte literal here:
- bgzf_eof = "\x1f\x8b\x08\x04\x00\x00\x00\x00\x00\xff\x06\x00BC" + \
- "\x02\x00\x1b\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+ bgzf_eof = (
+ "\x1f\x8b\x08\x04\x00\x00\x00\x00\x00\xff\x06\x00BC"
+ "\x02\x00\x1b\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+ )
if sys.version_info[0] >= 3:
import codecs
bgzf_eof = codecs.latin_1_encode(bgzf_eof)[0]
diff --git a/Tests/search_tests_common.py b/Tests/search_tests_common.py
index 1d5187aaa02..893eb8cd298 100644
--- a/Tests/search_tests_common.py
+++ b/Tests/search_tests_common.py
@@ -127,8 +127,8 @@ def compare_search_obj(obj_a, obj_b):
# compare objects recursively if it's not an HSPFragment
if not isinstance(obj_a, SearchIO.HSPFragment):
# check the number of hits contained
- assert len(obj_a) == len(obj_b), "length: %i vs %i for " \
- "%r vs %r" % (len(obj_a), len(obj_b), obj_a, obj_b)
+ assert len(obj_a) == len(obj_b), ("length: %i vs %i for %r vs %r"
+ % (len(obj_a), len(obj_b), obj_a, obj_b))
for item_a, item_b in zip(obj_a, obj_b):
assert compare_search_obj(item_a, item_b)
diff --git a/Tests/seq_tests_common.py b/Tests/seq_tests_common.py
index 053bb8a44aa..5cc6dfa65e4 100644
--- a/Tests/seq_tests_common.py
+++ b/Tests/seq_tests_common.py
@@ -275,9 +275,8 @@ def compare_record(old, new):
old_comment = old_comment.replace("\n", " ").replace(" ", " ")
new_comment = new_comment.replace("\n", " ").replace(" ", " ")
assert old_comment == new_comment, \
- "Comment annotation changed by load/retrieve\n" \
- "Was:%s\nNow:%s" \
- % (repr(old_comment), repr(new_comment))
+ ("Comment annotation changed by load/retrieve\n"
+ "Was:%s\nNow:%s" % (repr(old_comment), repr(new_comment)))
elif key in ["taxonomy", "organism", "source"]:
# If there is a taxon id recorded, these fields get overwritten
# by data from the taxon/taxon_name tables. There is no
diff --git a/Tests/test_AlignIO_FastaIO.py b/Tests/test_AlignIO_FastaIO.py
index 1f6b7b3f712..bb141318203 100644
--- a/Tests/test_AlignIO_FastaIO.py
+++ b/Tests/test_AlignIO_FastaIO.py
@@ -58,24 +58,24 @@ def test_output001(self):
self.assertEqual(len(alignments[2]), 2)
self.assertEqual(alignments[2].get_alignment_length(), 38)
self.assertEqual(
- alignments[2][0].seq, "MKKDKKYQIEAIKNKDKTLFIVYATDI" "YSPSEFFSKIE"
+ alignments[2][0].seq, "MKKDKKYQIEAIKNKDKTLFIVYATDIYSPSEFFSKIE"
)
self.assertEqual(alignments[2][0].id, "gi|10955264|ref|NP_052605.1|")
self.assertEqual(alignments[2][0].annotations["original_length"], 126)
self.assertEqual(
- alignments[2][1].seq, "IKKDLGVSFLKLKNREKTLIVDALKKK" "YPVAELLSVLQ"
+ alignments[2][1].seq, "IKKDLGVSFLKLKNREKTLIVDALKKKYPVAELLSVLQ"
)
self.assertEqual(alignments[2][1].id, "gi|152973462|ref|YP_001338513.1|")
self.assertEqual(alignments[2][1].annotations["original_length"], 101)
self.assertEqual(len(alignments[3]), 2)
self.assertEqual(alignments[3].get_alignment_length(), 43)
self.assertEqual(
- alignments[3][0].seq, "SELHSKLPKSIDKIHEDIKKQLSC-SL" "IMKKIDVEMEDYSTYC"
+ alignments[3][0].seq, "SELHSKLPKSIDKIHEDIKKQLSC-SLIMKKIDVEMEDYSTYC"
)
self.assertEqual(alignments[3][0].id, "gi|10955265|ref|NP_052606.1|")
self.assertEqual(alignments[3][0].annotations["original_length"], 346)
self.assertEqual(
- alignments[3][1].seq, "SRINSDVARRIPGIHRDPKDRLSSLKQ" "VEEALDMLISSHGEYC"
+ alignments[3][1].seq, "SRINSDVARRIPGIHRDPKDRLSSLKQVEEALDMLISSHGEYC"
)
self.assertEqual(alignments[3][1].id, "gi|152973545|ref|YP_001338596.1|")
self.assertEqual(alignments[3][1].annotations["original_length"], 242)
@@ -110,13 +110,13 @@ def test_output002(self):
self.assertEqual(alignments[1].get_alignment_length(), 53)
self.assertEqual(
alignments[1][0].seq,
- "EIRKRAAECGKTVSGFLRAAA-L" "GKKV----NSLTDDRVLKEVMRL" "GALQKKL",
+ "EIRKRAAECGKTVSGFLRAAA-LGKKV----NSLTDDRVLKEVMRLGALQKKL",
)
self.assertEqual(alignments[1][0].id, "gi|10955263|ref|NP_052604.1|")
self.assertEqual(alignments[1][0].annotations["original_length"], 107)
self.assertEqual(
alignments[1][1].seq,
- "EIKPRGTSKGEAIAAFMQEAPFI" "GRTPVFLGDDLTDESGFAVVNRL" "GGMSVKI",
+ "EIKPRGTSKGEAIAAFMQEAPFIGRTPVFLGDDLTDESGFAVVNRLGGMSVKI",
)
self.assertEqual(alignments[1][1].id, "gi|15831859|ref|NP_310632.1|")
self.assertEqual(alignments[1][1].annotations["original_length"], 266)
@@ -165,13 +165,13 @@ def test_output002(self):
self.assertEqual(alignments[4].get_alignment_length(), 63)
self.assertEqual(
alignments[4][0].seq,
- "VDIKK-ETIESELHSKLPKSIDK" "IHEDIKKQLSCSLI--MKKID-V" "EMEDYSTYCFSALRAIE",
+ "VDIKK-ETIESELHSKLPKSIDKIHEDIKKQLSCSLI--MKKID-VEMEDYSTYCFSALRAIE",
)
self.assertEqual(alignments[4][0].id, "gi|10955265|ref|NP_052606.1|")
self.assertEqual(alignments[4][0].annotations["original_length"], 346)
self.assertEqual(
alignments[4][1].seq,
- "IDPKKIEQIARQVHESMPKGIRE" "FGEDVEKKIRQTLQAQLTRLDLV" "SREEFDVQTQVLLRTRE",
+ "IDPKKIEQIARQVHESMPKGIREFGEDVEKKIRQTLQAQLTRLDLVSREEFDVQTQVLLRTRE",
)
self.assertEqual(alignments[4][1].id, "gi|38704138|ref|NP_311957.2|")
self.assertEqual(alignments[4][1].annotations["original_length"], 111)
@@ -212,13 +212,13 @@ def test_output003(self):
self.assertEqual(alignments[0].get_alignment_length(), 55)
self.assertEqual(
alignments[0][0].seq,
- "ISISNNKDQYEELQKEQGERDLK" "TVDQLVRIAAAGGGLRLSASTKT" "VDQLVRIAA",
+ "ISISNNKDQYEELQKEQGERDLKTVDQLVRIAAAGGGLRLSASTKTVDQLVRIAA",
)
self.assertEqual(alignments[0][0].id, "gi|152973837|ref|YP_001338874.1|")
self.assertEqual(alignments[0][0].annotations["original_length"], 183)
self.assertEqual(
alignments[0][1].seq,
- "VRLTAEEDQ--EIRKRAAECG-K" "TVSGFLRAAALGKKVNSLTDDR" "VLKEVMRLGA",
+ "VRLTAEEDQ--EIRKRAAECG-KTVSGFLRAAALGKKVNSLTDDRVLKEVMRLGA",
)
self.assertEqual(alignments[0][1].id, "gi|10955263|ref|NP_052604.1|")
self.assertEqual(alignments[0][1].annotations["original_length"], 107)
@@ -234,13 +234,13 @@ def test_output003(self):
self.assertEqual(alignments[2].get_alignment_length(), 63)
self.assertEqual(
alignments[2][0].seq,
- "VFGSFEQPKGEHLSGQVSEQ--R" "DTAFADQNEQVIRHLKQEIEHLN" "TLLLSKDSHIDSLKQAM",
+ "VFGSFEQPKGEHLSGQVSEQ--RDTAFADQNEQVIRHLKQEIEHLNTLLLSKDSHIDSLKQAM",
)
self.assertEqual(alignments[2][0].id, "gi|152973841|ref|YP_001338878.1|")
self.assertEqual(alignments[2][0].annotations["original_length"], 133)
self.assertEqual(
alignments[2][1].seq,
- "VYTSFN---GEKFSSYTLNKVTK" "TDEYNDLSELSASFFKKNFDKIN" "VNLLSKATSF-ALKKGI",
+ "VYTSFN---GEKFSSYTLNKVTKTDEYNDLSELSASFFKKNFDKINVNLLSKATSF-ALKKGI",
)
self.assertEqual(alignments[2][1].id, "gi|10955264|ref|NP_052605.1|")
self.assertEqual(alignments[2][1].annotations["original_length"], 126)
@@ -383,24 +383,24 @@ def test_output007(self):
self.assertEqual(len(alignments[2]), 2)
self.assertEqual(alignments[2].get_alignment_length(), 45)
self.assertEqual(
- alignments[2][0].seq, "EIRKRAAECGKTVSGFLRAAA--" "---LGKKVNSLTDDRVLKEVMR"
+ alignments[2][0].seq, "EIRKRAAECGKTVSGFLRAAA-----LGKKVNSLTDDRVLKEVMR"
)
self.assertEqual(alignments[2][0].id, "gi|10955263|ref|NP_052604.1|")
self.assertEqual(alignments[2][0].annotations["original_length"], 107)
self.assertEqual(
- alignments[2][1].seq, "ELVKLIADMGISVRALLRKNVEP" "YEELGLEEDKFTDDQLIDFMLQ"
+ alignments[2][1].seq, "ELVKLIADMGISVRALLRKNVEPYEELGLEEDKFTDDQLIDFMLQ"
)
self.assertEqual(alignments[2][1].id, "gi|152973480|ref|YP_001338531.1|")
self.assertEqual(alignments[2][1].annotations["original_length"], 141)
self.assertEqual(len(alignments[3]), 2)
self.assertEqual(alignments[3].get_alignment_length(), 38)
self.assertEqual(
- alignments[3][0].seq, "MKKDKKYQIEAIKNKDKTLFIVY" "ATDIYSPSEFFSKIE"
+ alignments[3][0].seq, "MKKDKKYQIEAIKNKDKTLFIVYATDIYSPSEFFSKIE"
)
self.assertEqual(alignments[3][0].id, "gi|10955264|ref|NP_052605.1|")
self.assertEqual(alignments[3][0].annotations["original_length"], 126)
self.assertEqual(
- alignments[3][1].seq, "IKKDLGVSFLKLKNREKTLIVDA" "LKKKYPVAELLSVLQ"
+ alignments[3][1].seq, "IKKDLGVSFLKLKNREKTLIVDALKKKYPVAELLSVLQ"
)
self.assertEqual(alignments[3][1].id, "gi|152973462|ref|YP_001338513.1|")
self.assertEqual(alignments[3][1].annotations["original_length"], 101)
@@ -415,32 +415,32 @@ def test_output007(self):
self.assertEqual(len(alignments[5]), 2)
self.assertEqual(alignments[5].get_alignment_length(), 40)
self.assertEqual(
- alignments[5][0].seq, "DKTLFIVYATDIYSPSE-FFSKI" "ESDLKKKKSKGD-VFFD"
+ alignments[5][0].seq, "DKTLFIVYATDIYSPSE-FFSKIESDLKKKKSKGD-VFFD"
)
self.assertEqual(alignments[5][0].id, "gi|10955264|ref|NP_052605.1|")
self.assertEqual(alignments[5][0].annotations["original_length"], 126)
self.assertEqual(
- alignments[5][1].seq, "ESVVFILMAGFAMSVCYLFFSVL" "EKVINARKSKDESIYHD"
+ alignments[5][1].seq, "ESVVFILMAGFAMSVCYLFFSVLEKVINARKSKDESIYHD"
)
self.assertEqual(alignments[5][1].id, "gi|152973581|ref|YP_001338632.1|")
self.assertEqual(alignments[5][1].annotations["original_length"], 84)
self.assertEqual(len(alignments[6]), 2)
self.assertEqual(alignments[6].get_alignment_length(), 30)
- self.assertEqual(alignments[6][0].seq, "ASFFKKNFDKINVNLLSKATSFA" "LKKGIPI")
+ self.assertEqual(alignments[6][0].seq, "ASFFKKNFDKINVNLLSKATSFALKKGIPI")
self.assertEqual(alignments[6][0].id, "gi|10955264|ref|NP_052605.1|")
self.assertEqual(alignments[6][0].annotations["original_length"], 126)
- self.assertEqual(alignments[6][1].seq, "ASFSKEEQDKVAVDKVAADVAWQ" "ERMNKPV")
+ self.assertEqual(alignments[6][1].seq, "ASFSKEEQDKVAVDKVAADVAWQERMNKPV")
self.assertEqual(alignments[6][1].id, "gi|152973536|ref|YP_001338587.1|")
self.assertEqual(alignments[6][1].annotations["original_length"], 84)
self.assertEqual(len(alignments[7]), 2)
self.assertEqual(alignments[7].get_alignment_length(), 43)
self.assertEqual(
- alignments[7][0].seq, "SELHSKLPKSIDKIHEDIKKQLS" "C-SLIMKKIDVEMEDYSTYC"
+ alignments[7][0].seq, "SELHSKLPKSIDKIHEDIKKQLSC-SLIMKKIDVEMEDYSTYC"
)
self.assertEqual(alignments[7][0].id, "gi|10955265|ref|NP_052606.1|")
self.assertEqual(alignments[7][0].annotations["original_length"], 346)
self.assertEqual(
- alignments[7][1].seq, "SRINSDVARRIPGIHRDPKDRLS" "SLKQVEEALDMLISSHGEYC"
+ alignments[7][1].seq, "SRINSDVARRIPGIHRDPKDRLSSLKQVEEALDMLISSHGEYC"
)
self.assertEqual(alignments[7][1].id, "gi|152973545|ref|YP_001338596.1|")
self.assertEqual(alignments[7][1].annotations["original_length"], 242)
@@ -807,10 +807,10 @@ def test_output008(self):
self.assertEqual(alignments[9][1].annotations["original_length"], 4301)
self.assertEqual(len(alignments[10]), 2)
self.assertEqual(alignments[10].get_alignment_length(), 30)
- self.assertEqual(alignments[10][0].seq, "IMMNKQFRNCMLTTICCGKNPL" "GDDEASAT")
+ self.assertEqual(alignments[10][0].seq, "IMMNKQFRNCMLTTICCGKNPLGDDEASAT")
self.assertEqual(alignments[10][0].id, "sp|P08100|OPSD_HUMAN")
self.assertEqual(alignments[10][0].annotations["original_length"], 348)
- self.assertEqual(alignments[10][1].seq, "MLLAFQFRNCMLTTLCCGKNPL" "GDDEASTT")
+ self.assertEqual(alignments[10][1].seq, "MLLAFQFRNCMLTTLCCGKNPLGDDEASTT")
self.assertEqual(alignments[10][1].id, "gi|283855845|gb|GQ290303.1|")
self.assertEqual(alignments[10][1].annotations["original_length"], 4301)
self.assertEqual(len(alignments[11]), 2)
@@ -819,7 +819,7 @@ def test_output008(self):
self.assertEqual(alignments[11][0].id, "sp|P08100|OPSD_HUMAN")
self.assertEqual(alignments[11][0].annotations["original_length"], 348)
self.assertEqual(
- alignments[11][1].seq, "SQQIRNATTMMMTMRVTSFSAFW" "VVADSCCW"
+ alignments[11][1].seq, "SQQIRNATTMMMTMRVTSFSAFWVVADSCCW"
)
self.assertEqual(alignments[11][1].id, "gi|283855822|gb|GQ290312.1|")
self.assertEqual(alignments[11][1].annotations["original_length"], 983)
diff --git a/Tests/test_GenBank.py b/Tests/test_GenBank.py
index 01451ad2292..38d7b493624 100644
--- a/Tests/test_GenBank.py
+++ b/Tests/test_GenBank.py
@@ -6354,7 +6354,7 @@ def test_001_genbank_bad_origin_wrapping_location(self):
with self.assertRaises(BiopythonParserWarning) as cm:
record = SeqIO.read(path, "genbank")
self.assertIn(
- "It appears that '6801..100' is a feature " "that spans the origin",
+ "It appears that '6801..100' is a feature that spans the origin",
str(cm.exception),
)
@@ -6385,19 +6385,19 @@ def test_compound_complex_origin_wrap(self):
self.assertIsInstance(record.features[3].location, CompoundLocation)
self.assertEqual(
str(record.features[3].location),
- "join{[<5399:5600](+), [5699:6100](+), " "[6800:7000](+), [0:100](+)}",
+ "join{[<5399:5600](+), [5699:6100](+), [6800:7000](+), [0:100](+)}",
)
self.assertIsInstance(record.features[4].location, CompoundLocation)
self.assertEqual(
str(record.features[4].location),
- "join{[5399:5600](+), [5699:6100](+), " "[<6800:7000](+), [0:100](+)}",
+ "join{[5399:5600](+), [5699:6100](+), [<6800:7000](+), [0:100](+)}",
)
self.assertIsInstance(record.features[5].location, CompoundLocation)
self.assertEqual(
str(record.features[5].location),
- "join{[5399:5600](+), [5699:6100](+), " "[0:100](-), [<6800:7000](-)}",
+ "join{[5399:5600](+), [5699:6100](+), [0:100](-), [<6800:7000](-)}",
)
def test_implicit_orign_wrap_extract_and_translate(self):
@@ -6410,11 +6410,11 @@ def test_implicit_orign_wrap_extract_and_translate(self):
seq_features = seq_record.features
self.assertEqual(
str(seq_features[1].extract(seq_record).seq.lower()),
- "atgccctataaaacccagggctgccttggaaaaggcgcaacccc" "aaccccctcgagccgcggcatataa",
+ "atgccctataaaacccagggctgccttggaaaaggcgcaaccccaaccccctcgagccgcggcatataa",
)
self.assertEqual(
str(seq_features[2].extract(seq_record).seq.lower()),
- "atgccgcggctcgagggggttggggttgcgccttttccaaggca" "gccctgggttttatag",
+ "atgccgcggctcgagggggttggggttgcgccttttccaaggcagccctgggttttatag",
)
self.assertEqual(
str(seq_features[1].extract(seq_record).seq.translate()),
@@ -7231,7 +7231,7 @@ def test_genbank_interaction(self):
self.assertEqual(l_r[0].id, "NC_000932.1")
self.assertEqual(l_r[0].name, "NC_000932")
self.assertEqual(
- l_r[0].description, "Arabidopsis thaliana chloroplast, " "complete genome"
+ l_r[0].description, "Arabidopsis thaliana chloroplast, complete genome"
)
self.assertEqual(len(l_r[0].features), 0)
@@ -7242,7 +7242,7 @@ def test_genbank_interaction(self):
self.assertEqual(l_r[0].id, "NC_000932.1")
self.assertEqual(l_r[0].name, "NC_000932")
self.assertEqual(
- l_r[0].description, "Arabidopsis thaliana chloroplast, " "complete genome"
+ l_r[0].description, "Arabidopsis thaliana chloroplast, complete genome"
)
self.assertEqual(len(l_r[0].features), 259)
diff --git a/Tests/test_GenomeDiagram.py b/Tests/test_GenomeDiagram.py
index b9b07351bd5..b2bdcf8f6a1 100755
--- a/Tests/test_GenomeDiagram.py
+++ b/Tests/test_GenomeDiagram.py
@@ -643,12 +643,14 @@ def tearDown(self):
def test_str(self):
"""Test diagram's info as string."""
- expected = "\n<: Test Diagram>" \
- "\n1 tracks" \
- "\nTrack 1: " \
- "\n<: CDS Features>" \
- "\n0 sets" \
- "\n"
+ expected = (
+ "\n<: Test Diagram>"
+ "\n1 tracks"
+ "\nTrack 1: "
+ "\n<: CDS Features>"
+ "\n0 sets"
+ "\n"
+ )
self.assertEqual(expected, str(self.gdd))
def test_add_track(self):
@@ -679,23 +681,27 @@ def test_get_tracks(self):
def test_move_track(self):
"""Move a track."""
self.gdd.move_track(1, 2)
- expected = "\n<: Test Diagram>" \
- "\n1 tracks" \
- "\nTrack 2: " \
- "\n<: CDS Features>" \
- "\n0 sets" \
- "\n"
+ expected = (
+ "\n<: Test Diagram>"
+ "\n1 tracks"
+ "\nTrack 2: "
+ "\n<: CDS Features>"
+ "\n0 sets"
+ "\n"
+ )
self.assertEqual(expected, str(self.gdd))
def test_renumber(self):
"""Test renumbering tracks."""
self.gdd.renumber_tracks(0)
- expected = "\n<: Test Diagram>" \
- "\n1 tracks" \
- "\nTrack 0: " \
- "\n<: CDS Features>" \
- "\n0 sets" \
- "\n"
+ expected = (
+ "\n<: Test Diagram>"
+ "\n1 tracks"
+ "\nTrack 0: "
+ "\n<: CDS Features>"
+ "\n0 sets"
+ "\n"
+ )
self.assertEqual(expected, str(self.gdd))
def test_write_arguments(self):
diff --git a/Tests/test_Nexus.py b/Tests/test_Nexus.py
index 79385e09f11..40486b52105 100755
--- a/Tests/test_Nexus.py
+++ b/Tests/test_Nexus.py
@@ -465,8 +465,10 @@ def test_TreeTest1(self):
def test_TreeTest2(self):
"""Handle text labels on internal nodes."""
- ts1b = "(Cephalotaxus:125.000000,(Taxus:100.000000,Torreya:100.000000)" \
- "TT1:25.000000)Taxaceae:90.000000;"
+ ts1b = (
+ "(Cephalotaxus:125.000000,(Taxus:100.000000,Torreya:100.000000)"
+ "TT1:25.000000)Taxaceae:90.000000;"
+ )
tree = Trees.Tree(ts1b)
self.assertEqual(self._get_flat_nodes(tree), [("Taxaceae", 90.0, None, None),
("Cephalotaxus", 125.0, None, None),
diff --git a/Tests/test_PDB_MMCIFParser.py b/Tests/test_PDB_MMCIFParser.py
index 0ed5b95ff4f..87484db538e 100644
--- a/Tests/test_PDB_MMCIFParser.py
+++ b/Tests/test_PDB_MMCIFParser.py
@@ -235,11 +235,12 @@ def test_insertions(self):
self.assertEqual(pp[0].get_id()[1], 16)
self.assertEqual(pp[-1].get_id()[1], 244)
# Check the sequence
- refseq = "IIGGEFTTIENQPWFAAIYRRHRGGSVTYVCGGSLISPCWVISATHCFIDYPKKEDYIVYLGR" \
- "SRLNSNTQGEMKFEVENLILHKDYSADTLAYHNDIALLKIRSKEGRCAQPSRTIQTIALPSMY" \
- "NDPQFGTSCEITGFGKEQSTDYLYPEQLKMTVVKLISHRECQQPHYYGSEVTTKMLCAADPQW" \
- "KTDSCQGDSGGPLVCSLQGRMTLTGIVSWGRGCALKDKPGVYTRVSHFLPWIRSHTKE"
-
+ refseq = (
+ "IIGGEFTTIENQPWFAAIYRRHRGGSVTYVCGGSLISPCWVISATHCFIDYPKKEDYIVYLGR"
+ "SRLNSNTQGEMKFEVENLILHKDYSADTLAYHNDIALLKIRSKEGRCAQPSRTIQTIALPSMY"
+ "NDPQFGTSCEITGFGKEQSTDYLYPEQLKMTVVKLISHRECQQPHYYGSEVTTKMLCAADPQW"
+ "KTDSCQGDSGGPLVCSLQGRMTLTGIVSWGRGCALKDKPGVYTRVSHFLPWIRSHTKE"
+ )
s = pp.get_sequence()
self.assertTrue(isinstance(s, Seq))
self.assertEqual(s.alphabet, generic_protein)
diff --git a/Tests/test_SeqIO_PdbIO.py b/Tests/test_SeqIO_PdbIO.py
index 81de98898cc..eaa7c9edced 100644
--- a/Tests/test_SeqIO_PdbIO.py
+++ b/Tests/test_SeqIO_PdbIO.py
@@ -117,12 +117,14 @@ def test_atom_parse(self):
with warnings.catch_warnings():
warnings.simplefilter("ignore", PDBConstructionWarning)
chains = list(SeqIO.parse("PDB/2XHE." + extension, parser))
- actual_seq = "DRLSRLRQMAAENQXXXXXXXXXXXXXXXXXXXXXXXPEPFMADFFNRVK"\
- "RIRDNIEDIEQAIEQVAQLHTESLVAVSKEDRDRLNEKLQDTMARISALG"\
- "NKIRADLKQIEKENKRAQQEGTFEDGTVSTDLRIRQSQHSSLSRKFVKVM"\
- "TRYNDVQAENKRRYGENVARQCRVVEPSLSDDAIQKVIEHGXXXXXXXXX"\
- "XXXXXXXXNEIRDRHKDIQQLERSLLELHEMFTDMSTLVASQGEMIDRIE"\
- "FSVEQSHNYV"
+ actual_seq = (
+ "DRLSRLRQMAAENQXXXXXXXXXXXXXXXXXXXXXXXPEPFMADFFNRVK"
+ "RIRDNIEDIEQAIEQVAQLHTESLVAVSKEDRDRLNEKLQDTMARISALG"
+ "NKIRADLKQIEKENKRAQQEGTFEDGTVSTDLRIRQSQHSSLSRKFVKVM"
+ "TRYNDVQAENKRRYGENVARQCRVVEPSLSDDAIQKVIEHGXXXXXXXXX"
+ "XXXXXXXXNEIRDRHKDIQQLERSLLELHEMFTDMSTLVASQGEMIDRIE"
+ "FSVEQSHNYV"
+ )
self.assertEqual(str(chains[1].seq), actual_seq)
def test_atom_read(self):
diff --git a/Tests/test_SeqRecord.py b/Tests/test_SeqRecord.py
index f9c5580ab17..ad93005b84a 100644
--- a/Tests/test_SeqRecord.py
+++ b/Tests/test_SeqRecord.py
@@ -143,8 +143,10 @@ def test_str(self):
self.assertEqual(expected.lstrip(), str(self.record))
def test_repr(self):
- expected = "SeqRecord(seq=Seq('ABCDEFGHIJKLMNOPQRSTUVWZYX', ProteinAlphabet()), " \
- "id='TestID', name='TestName', description='TestDescr', dbxrefs=['TestXRef'])"
+ expected = (
+ "SeqRecord(seq=Seq('ABCDEFGHIJKLMNOPQRSTUVWZYX', ProteinAlphabet()), "
+ "id='TestID', name='TestName', description='TestDescr', dbxrefs=['TestXRef'])"
+ )
self.assertEqual(expected, repr(self.record))
def test_format(self):
diff --git a/Tests/test_Uniprot.py b/Tests/test_Uniprot.py
index fe16956aa9a..1481b8e9839 100644
--- a/Tests/test_Uniprot.py
+++ b/Tests/test_Uniprot.py
@@ -221,7 +221,7 @@ def test_uni003(self):
"muscle system."])
self.assertEqual(seq_record.annotations["comment_induction"],
["Repressed in presence of fatty acids. Repressed "
- "3-fold by ""lipid precursors, inositol and "
+ "3-fold by lipid precursors, inositol and "
"choline, and also controlled by regulatory "
"factors INO2, INO4 and OPI1."])
self.assertEqual(seq_record.annotations["comment_interaction_intactId"],
diff --git a/Tests/test_cellosaurus.py b/Tests/test_cellosaurus.py
index bc7b03b1aba..49610f69b72 100644
--- a/Tests/test_cellosaurus.py
+++ b/Tests/test_cellosaurus.py
@@ -125,10 +125,12 @@ def test__str__(self):
"""Test string function."""
handle = open("Cellosaurus/cell_lines_3.txt")
record = cellosaurus.read(handle)
- input = "ID: ZZ-R 127 AC: CVCL_5418 AS: SY: ZZ-R DR: [('CCLV', 'CCLV-RIE 0127')] " \
- "RX: ['PubMed=19656987;', 'PubMed=19941903;'] WW: [] CC: [] ST: [] DI: [] " \
- "OX: ['NCBI_TaxID=9925; ! Capra hircus'] HI: [] OI: [] SX: CA: " \
- "Spontaneously immortalized cell line"
+ input = (
+ "ID: ZZ-R 127 AC: CVCL_5418 AS: SY: ZZ-R DR: [('CCLV', 'CCLV-RIE 0127')] "
+ "RX: ['PubMed=19656987;', 'PubMed=19941903;'] WW: [] CC: [] ST: [] DI: [] "
+ "OX: ['NCBI_TaxID=9925; ! Capra hircus'] HI: [] OI: [] SX: CA: "
+ "Spontaneously immortalized cell line"
+ )
self.assertEquals(record.__str__(), input)
diff --git a/Tests/test_phenotype.py b/Tests/test_phenotype.py
index b68a3cc6c18..53ce70e8e32 100644
--- a/Tests/test_phenotype.py
+++ b/Tests/test_phenotype.py
@@ -142,10 +142,10 @@ def test_PlateRecord(self):
p2 = p.subtract_control()
self.assertEqual(p2.id, p.id)
self.assertEqual(p2["A02"], p["A02"] - p["A01"])
- self.assertEqual(repr(p), "PlateRecord('WellRecord['A01'], WellRecord" +
+ self.assertEqual(repr(p), "PlateRecord('WellRecord['A01'], WellRecord"
"['A02'], WellRecord['A03'], ..., WellRecord['B12']')")
- self.assertEqual(str(p), "Plate ID: PM01\nWell: 24\nRows: 2\nColumns: " +
- "12\nPlateRecord('WellRecord['A01'], WellRecord['A02'], WellRecord" +
+ self.assertEqual(str(p), "Plate ID: PM01\nWell: 24\nRows: 2\nColumns: "
+ "12\nPlateRecord('WellRecord['A01'], WellRecord['A02'], WellRecord"
"['A03'], ..., WellRecord['B12']')")
with open(SMALL_JSON_PLATE_2) as handle:
@@ -232,15 +232,18 @@ def test_WellRecord(self):
self.assertEqual(w.get_times()[-1], 95.75)
self.assertEqual(w.get_signals()[0], 37.0)
self.assertEqual(w.get_signals()[-1], 217.0)
- self.assertEqual(repr(w),
- "WellRecord('(0.0, 37.0), (0.25, 29.0), (0.5, 32.0)," +
- " (0.75, 30.0), (1.0, 29.0), ..., (95.75, 217.0)')")
- self.assertEqual(str(w),
- "Well ID: A10\nTime points: 384\nMinum signal 0.25 at " +
- "time 29.00\nMaximum signal 16.75 at time " +
- "313.00\nWellRecord('(0.0, 37.0), (0.25, 29.0), " +
- "(0.5, 32.0), (0.75, 30.0), " +
- "(1.0, 29.0), ..., (95.75, 217.0)')")
+ self.assertEqual(
+ repr(w),
+ "WellRecord('(0.0, 37.0), (0.25, 29.0), (0.5, 32.0),"
+ " (0.75, 30.0), (1.0, 29.0), ..., (95.75, 217.0)')"
+ )
+ self.assertEqual(
+ str(w),
+ "Well ID: A10\nTime points: 384\nMinum signal 0.25 at time 29.00\n"
+ "Maximum signal 16.75 at time 313.00\n"
+ "WellRecord('(0.0, 37.0), (0.25, 29.0), (0.5, 32.0), (0.75, 30.0), "
+ "(1.0, 29.0), ..., (95.75, 217.0)')"
+ )
w.fit(None)
self.assertEqual(w.area, None)
diff --git a/Tests/test_seq.py b/Tests/test_seq.py
index c653d73ec53..e54915e04c6 100644
--- a/Tests/test_seq.py
+++ b/Tests/test_seq.py
@@ -103,8 +103,10 @@ def test_repr(self):
def test_truncated_repr(self):
seq = "TCAAAAGGATGCATCATGTCAAAAGGATGCATCATGTCAAAAGGATGCATCATGTCAAAAGGA"
- expected = "Seq('TCAAAAGGATGCATCATGTCAAAAGGATGCATCATGTCAAAAGGATGC" + \
- "ATCATG...GGA', IUPACAmbiguousDNA())"
+ expected = (
+ "Seq('TCAAAAGGATGCATCATGTCAAAAGGATGCATCATGTCAAAAGGATGCATCATG...GGA', "
+ "IUPACAmbiguousDNA())"
+ )
self.assertEqual(expected, repr(Seq.Seq(seq, IUPAC.ambiguous_dna)))
def test_length(self):
@@ -634,8 +636,10 @@ def test_repr(self):
def test_truncated_repr(self):
seq = "TCAAAAGGATGCATCATGTCAAAAGGATGCATCATGTCAAAAGGATGCATCATGTCAAAAGGA"
- expected = "MutableSeq('TCAAAAGGATGCATCATGTCAAAAGGATGCATCATGTCAAA" + \
- "AGGATGCATCATG...GGA', IUPACAmbiguousDNA())"
+ expected = (
+ "MutableSeq('TCAAAAGGATGCATCATGTCAAAAGGATGCATCATGTCAAAAGGATGCATCATG...GGA', "
+ "IUPACAmbiguousDNA())"
+ )
self.assertEqual(expected, repr(MutableSeq(seq, IUPAC.ambiguous_dna)))
def test_equal_comparison(self):