fix: add missing self to reindex_subcomponent_taxa#233
Conversation
TaxonNamespaceAssociated.reindex_subcomponent_taxa was defined without self but called as self.reindex_subcomponent_taxa() from reindex_taxa(), raising TypeError instead of the intended NotImplementedError on any class relying on the base stub (e.g. TreeList). TreeList's own override in treecollectionmodel.py had the same bug. Both now take self. Signed-off-by: Mike German <mike@stepsventures.com>
|
Thanks for the contribution @steps-re ! I can add a regression test based on the minimum working bug you provided, and hopefully get this merged in and release a patch shortly. |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #233 +/- ##
=======================================
Coverage 88.69% 88.70%
=======================================
Files 114 114
Lines 12844 12853 +9
=======================================
+ Hits 11392 11401 +9
Misses 1452 1452
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Tests drafted via @claude and hand-reviewed.
|
Thanks again for the contribution @steps-re , the fix should be deployed as |
TaxonNamespaceAssociated.reindex_subcomponent_taxais defined withoutself:but it's called as
self.reindex_subcomponent_taxa()fromreindex_taxa(). Any class that relies on the base stub (instead of overriding it) hits aTypeErrorthe momentreindex_taxa()runs, instead of the intendedNotImplementedError.TreeListis one such class: it doesn't overridereindex_subcomponent_taxa... wait, it does, but with the identical bug intreecollectionmodel.py:Repro before the fix:
Tree.reindex_taxa()andCharacterMatrix.reindex_taxa()work fine since those subclasses overridereindex_subcomponent_taxa(self)correctly withselfalready. This PR adds the missingselfto the two remaining definitions so the call succeeds and, for classes without a real implementation, raisesNotImplementedErroras designed rather than crashing with a confusingTypeError.Ran the taxon and tree-collection test suites plus the full unit suite locally: 884 passed, 4 pre-existing failures unrelated to this change (they need the external
paupbinary, which isn't installed in my environment).