def test_remove_taxon(self): taxa = [Taxon(s) for s in self.str_labels] tns = TaxonNamespace(taxa) expected = taxa[:] for idx, taxon in enumerate(taxa): tns.remove_taxon(taxon) expected.remove(taxon) self.assertEqual(len(tns), len(expected)) for idx2, taxon2 in enumerate(expected): if taxon2 in expected: self.assertIn(taxon2, tns) elif taxon2 not in expected: self.assertNotIn(taxon2, tns)
def test_remove_taxon_error(self): tns = TaxonNamespace(self.str_labels) with self.assertRaises(ValueError): tns.remove_taxon(self.taxa[0])