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
2 changes: 1 addition & 1 deletion src/dendropy/datamodel/taxonmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def reindex_taxa(self, taxon_namespace=None, clear=False):
self.reindex_subcomponent_taxa()
return self.taxon_namespace

def reindex_subcomponent_taxa():
def reindex_subcomponent_taxa(self):
"""
DEPRECATED: Use :meth:`reconstruct_taxon_namespace()` instead.
Derived classes should override this to ensure that their various
Expand Down
2 changes: 1 addition & 1 deletion src/dendropy/datamodel/treecollectionmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ def poll_taxa(self, taxa=None):
tree.poll_taxa(taxa)
return taxa

def reindex_subcomponent_taxa():
def reindex_subcomponent_taxa(self):
raise NotImplementedError()

##############################################################################
Expand Down
17 changes: 17 additions & 0 deletions tests/unittests/test_datamodel_tree_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import collections
import dendropy
import random
import warnings
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
Expand Down Expand Up @@ -1011,6 +1012,22 @@ def test_migrate_taxon_namespace_unifying_case_insensitive(self):
case_sensitive_label_mapping=False,
original_tns=original_tns)

def test_reindex_subcomponent_taxa_raises_not_implemented(self):
# Regression: the stub was defined without a `self` parameter, so
# calling it as an instance method raised TypeError instead of the
# intended NotImplementedError.
with self.assertRaises(NotImplementedError):
self.tree_list.reindex_subcomponent_taxa()

def test_reindex_taxa_raises_not_implemented(self):
# `reindex_taxa` is deprecated and delegates to
# `reindex_subcomponent_taxa`; it should surface NotImplementedError
# rather than a TypeError about positional argument counts.
with warnings.catch_warnings():
warnings.simplefilter("ignore")
with self.assertRaises(NotImplementedError):
self.tree_list.reindex_taxa()

class TestTreeListAppend(
curated_test_tree.CuratedTestTree,
unittest.TestCase):
Expand Down
Loading