def test_new_taxon_to_immutable(self): tns = TaxonNamespace() tns.is_mutable = False for idx, label in enumerate(self.str_labels): with self.assertRaises(TypeError): t = tns.new_taxon(label) self.assertEqual(len(tns), 0)
def test_require_taxon_by_label_add_to_immutable(self): tns = TaxonNamespace(self.str_labels) tns.is_mutable = False check = ["u", "x", "y",] for label in check: assert label not in self.str_labels with self.assertRaises(TypeError): t = tns.require_taxon(label)
def test_basic_adding_to_immutable(self): tns = TaxonNamespace() self.assertEqual(len(tns), 0) tns.is_mutable = False for idx, label in enumerate(self.str_labels): with self.assertRaises(TypeError): tns.add_taxon(Taxon(label=label)) self.assertEqual(len(tns), 0)
def test_new_taxa_to_immutable(self): tns = TaxonNamespace() tns.is_mutable = False with self.assertRaises(TypeError): tns.new_taxa(self.str_labels) self.assertEqual(len(tns), 0)