Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ set -e

# lint for Python syntax errors or undefined names\
ruff check --format=github --select=E9,F63,F7,F82,W605 --extend-exclude=docs/source/schemas/interfaces,src/dendropy/dataio/_beast2_v2_7_8_lark_standalone.py --target-version=py37 .

# lint for duplicated test names, which discards tests
ruff check --format=github --select=F811 --target-version=py37 tests/unittests
8 changes: 4 additions & 4 deletions tests/unittests/test_dataio_newick_reader_rooting.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_with_unrooted_token_ucase(self):
nr = newickreader.NewickReader(rooting="force-unrooted")
self.assertIs(nr._parse_tree_rooting_state("&u"), False)

def test_with_unrooted_token_ucase(self):
def test_with_unrooted_token_Ucase(self):
nr = newickreader.NewickReader(rooting="force-unrooted")
self.assertIs(nr._parse_tree_rooting_state("&U"), False)

Expand Down Expand Up @@ -106,7 +106,7 @@ def test_with_unrooted_token_ucase(self):
nr = newickreader.NewickReader(rooting="force-rooted")
self.assertIs(nr._parse_tree_rooting_state("&u"), True)

def test_with_unrooted_token_ucase(self):
def test_with_unrooted_token_Ucase(self):
nr = newickreader.NewickReader(rooting="force-rooted")
self.assertIs(nr._parse_tree_rooting_state("&U"), True)

Expand Down Expand Up @@ -136,7 +136,7 @@ def test_with_unrooted_token_ucase(self):
nr = newickreader.NewickReader(rooting="default-unrooted")
self.assertIs(nr._parse_tree_rooting_state("&u"), False)

def test_with_unrooted_token_ucase(self):
def test_with_unrooted_token_Ucase(self):
nr = newickreader.NewickReader(rooting="default-unrooted")
self.assertIs(nr._parse_tree_rooting_state("&U"), False)

Expand Down Expand Up @@ -166,7 +166,7 @@ def test_with_unrooted_token_ucase(self):
nr = newickreader.NewickReader(rooting="default-rooted")
self.assertIs(nr._parse_tree_rooting_state("&u"), False)

def test_with_unrooted_token_ucase(self):
def test_with_unrooted_token_Ucase(self):
nr = newickreader.NewickReader(rooting="default-rooted")
self.assertIs(nr._parse_tree_rooting_state("&U"), False)

Expand Down
2 changes: 0 additions & 2 deletions tests/unittests/test_dataio_newick_reader_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
import dendropy
from dendropy.utility import error
from dendropy.dataio import newickreader
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
from support import dendropytest
from support import standard_file_test_trees
Expand Down
1 change: 0 additions & 1 deletion tests/unittests/test_dataio_newick_reader_tree_iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import unittest
import dendropy
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
from support import dendropytest
from support import standard_file_test_trees
Expand Down
1 change: 0 additions & 1 deletion tests/unittests/test_dataio_newick_reader_tree_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import unittest
import dendropy
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
from support import dendropytest
from support import standard_file_test_trees
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/test_dataio_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_captured_delimiters(self):
]
self.check_tokenization(input_str, expected)

def test_comments(self):
def test_capture_comments(self):
input_str = "([the quick]apple[brown],([fox]banjo,([jumps]cucumber[over the],[really]dogwood)[lazy]eggplant)) rhubarb[dog];";
expected_comments = {
"apple" : ["the quick", "brown"],
Expand Down
6 changes: 3 additions & 3 deletions tests/unittests/test_datamodel_charmatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def test_setitem_by_idx_not_in_namespace(self):
with self.assertRaises(IndexError):
char_matrix[len(tns)] = []

def test_setitem_by_idx_not_in_namespace(self):
def test_setitem_by_label_not_in_namespace(self):
tns = get_taxon_namespace(3)
char_matrix = charmatrixmodel.CharacterMatrix()
with self.assertRaises(KeyError):
Expand Down Expand Up @@ -301,7 +301,7 @@ def test_fill_taxa(self):
for taxon in tns:
self.assertIn(taxon, char_matrix)

def test_fill_taxa(self):
def test_pack_pads_taxa_to_equal_length(self):
tns = get_taxon_namespace(5)
char_matrix = charmatrixmodel.CharacterMatrix(taxon_namespace=tns)
s = ["z"] * 10
Expand Down Expand Up @@ -1151,7 +1151,7 @@ def setUp(self):
def test_basic_taxa(self):
self.assertEqual(self.char_matrix.poll_taxa(), self.expected_taxa)

class TestCharacterMatrixTaxa(dendropytest.ExtendedTestCase):
class TestCharacterMatrixPurgeTaxonNamespace(dendropytest.ExtendedTestCase):

def setUp(self):
self.char_matrix = charmatrixmodel.CharacterMatrix()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,6 @@ def test_construction_from_another_tree_different_label(self):
self.assertNotEqual(tree1.label, "tree2")
self.assertNotEqual(tree1.label, tree2.label)

def test_construction_from_given_seed_node(self):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why deletions? Are these just straight up duplications of another test?

tree1, anodes1, lnodes1, inodes1 = self.get_tree(
suppress_internal_node_taxa=False,
suppress_leaf_node_taxa=False)
tree2 = dendropy.Tree(seed_node=tree1.seed_node)
self.assertIs(tree2.seed_node, tree1.seed_node)

def test_construction_from_given_seed_node(self):
tree1, anodes1, lnodes1, inodes1 = self.get_tree(
suppress_internal_node_taxa=False,
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/test_datamodel_tree_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def test_remove(self):
self.assertEqual(len(tlist), 4)
self.assertNotIn(t, tlist)

def test_remove(self):
def test_reverse(self):
tlist = curated_test_tree_list.get_tree_list(5)
clist = list(tlist._trees)
tlist.reverse()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def test_ageorder_node_iter_unfiltered_reversed(self):
exp = [x[1] for x in nda]
self.assertSequenceEqual(visited_labels, exp)

def test_leaf_node_iter_filtered(self):
def test_ageorder_node_iter_filtered(self):
tree, anodes, lnodes, inodes = self.get_tree()
f = lambda x: x.edge.length > 13
nodes = [nd for nd in tree.ageorder_node_iter(filter_fn=f)]
Expand Down
1 change: 0 additions & 1 deletion tests/unittests/test_fitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import random
import unittest
import math
import sys
import dendropy
from dendropy.calculate.treescore import fitch_down_pass
sys.path.insert(0, os.path.dirname(__file__))
Expand Down
12 changes: 0 additions & 12 deletions tests/unittests/test_phylogenetic_distance_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,18 +265,6 @@ def test_max_pairwise_weighted_distance_taxa(self):
obs_maxt = self.pdm.max_pairwise_distance_taxa(is_weighted_edge_distances=True)
self.assertEqual(set(obs_maxt), maxt)

def test_max_pairwise_weighted_distance_taxa(self):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

same as above

maxd = None
maxt = None
for taxon1 in self.tree.taxon_namespace:
for taxon2 in self.tree.taxon_namespace:
d = self.reference_pdm_weighted_table[taxon1.label, taxon2.label]
if maxd is None or d > maxd:
maxd = d
maxt = set([taxon1, taxon2])
obs_maxt = self.pdm.max_pairwise_distance_taxa(is_weighted_edge_distances=True)
self.assertEqual(set(obs_maxt), maxt)

def test_max_pairwise_unweighted_distance_taxa(self):
maxd = None
maxts = []
Expand Down
Loading