def testBoundTaxonNamespaceDefault(self):
     d = dendropy.DataSet()
     t = dendropy.TaxonNamespace()
     d.attach_taxon_namespace(t)
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertIs(d.taxon_namespaces[0], d.attached_taxon_namespace)
     d.read(path=pathmap.mixed_source_path(
         'reference_single_taxonset_dataset.nex'),
            schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.mle.nex'),
            schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(
         path=pathmap.tree_source_path('pythonidae.reference-trees.newick'),
         schema="newick")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.char_source_path('caenophidia_mos.chars.fasta'),
            schema="fasta",
            data_type="protein")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 147)
 def test_attached_taxon_namespace(self):
     tns = dendropy.TaxonNamespace()
     ds = dendropy.DataSet.get_from_path(
         pathmap.mixed_source_path('multitaxa_mesquite.nex'),
         "nexus",
         taxon_namespace=tns)
     self.verify_attached_taxon_namespace(ds, tns)
 def testAttachTaxonNamespaceOnGet(self):
     t = dendropy.TaxonNamespace()
     d = dendropy.DataSet.get_from_path(
         pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'),
         "nexus",
         taxon_namespace=t)
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertIsNot(d.attached_taxon_namespace, None)
     self.assertIs(d.taxon_namespaces[0], d.attached_taxon_namespace)
     self.assertIs(d.attached_taxon_namespace, t)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.mle.nex'),
            schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(
         path=pathmap.tree_source_path('pythonidae.reference-trees.newick'),
         schema="newick")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.detach_taxon_namespace()
     d.read_from_path(
         pathmap.char_source_path('caenophidia_mos.chars.fasta'),
         schema="fasta",
         data_type="protein")
     self.assertEqual(len(d.taxon_namespaces), 2)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     self.assertEqual(len(d.taxon_namespaces[1]), 114)
 def get_source_dataset(self, **kwargs):
     src_ds = dendropy.DataSet.get_from_path(
             pathmap.mixed_source_path("standard-test-mixed.1.basic.nexus"),
             "nexus",
             **kwargs
             )
     return src_ds
 def test_attached_taxon_namespace(self):
     tns = dendropy.TaxonNamespace()
     ds = dendropy.DataSet.get_from_path(
             pathmap.mixed_source_path('multitaxa_mesquite.nex'),
             "nexus",
             taxon_namespace=tns)
     self.verify_attached_taxon_namespace(ds, tns)
 def test_basic_get(self):
     src_filename = "standard-test-mixed.1.basic.nexus"
     src_path = pathmap.mixed_source_path(src_filename)
     ds = dendropy.DataSet.get_from_path(
             src_path,
             "nexus",
             suppress_internal_node_taxa=False, # so internal labels get translated
             )
     self.verify_dataset(ds)
 def test_default(self):
     d0 = dendropy.DataSet.get_from_path(
         pathmap.mixed_source_path('multitaxa_mesquite.nex'), "nexus")
     s = self.write_out_validate_equal_and_return(d0, "nexus", {})
     ds = dendropy.DataSet.get_from_string(
         s,
         "nexus",
     )
     self.verify_unrestricted(ds)
 def test_basic_get(self):
     src_filename = "standard-test-mixed.1.basic.nexus"
     src_path = pathmap.mixed_source_path(src_filename)
     ds = dendropy.DataSet.get_from_path(
         src_path,
         "nexus",
         suppress_internal_node_taxa=
         False,  # so internal labels get translated
     )
     self.verify_dataset(ds)
 def test_default(self):
     d0 = dendropy.DataSet.get_from_path(
             pathmap.mixed_source_path('multitaxa_mesquite.nex'),
             "nexus")
     s = self.write_out_validate_equal_and_return(
             d0, "nexus", {})
     ds = dendropy.DataSet.get_from_string(
             s, "nexus",
             )
     self.verify_unrestricted(ds)
 def test_attached_taxon_namespace(self):
     d0 = dendropy.DataSet.get_from_path(
             pathmap.mixed_source_path('multitaxa_mesquite.nex'),
             "nexus")
     for tns in d0.taxon_namespaces:
         d0.attach_taxon_namespace(tns)
         s = self.write_out_validate_equal_and_return(
                 d0, "nexus", {})
         ds = dendropy.DataSet.get_from_string(s, "nexus",)
         self.verify_attached_taxon_namespace_written(ds, tns)
 def test_attached_taxon_namespace(self):
     d0 = dendropy.DataSet.get_from_path(
         pathmap.mixed_source_path('multitaxa_mesquite.nex'), "nexus")
     for tns in d0.taxon_namespaces:
         d0.attach_taxon_namespace(tns)
         s = self.write_out_validate_equal_and_return(d0, "nexus", {})
         ds = dendropy.DataSet.get_from_string(
             s,
             "nexus",
         )
         self.verify_attached_taxon_namespace_written(ds, tns)
 def test_basic_read(self):
     src_filename = "standard-test-mixed.1.basic.nexus"
     src_path = pathmap.mixed_source_path(src_filename)
     ds = dendropy.DataSet()
     result = ds.read(
             path=src_path,
             schema="nexus",
             suppress_internal_node_taxa=False, # so internal labels get translated
             )
     self.assertEqual(result, (1, 7, 4))
     self.verify_dataset(ds)
 def test_basic_read(self):
     src_filename = "standard-test-mixed.1.basic.nexus"
     src_path = pathmap.mixed_source_path(src_filename)
     ds = dendropy.DataSet()
     result = ds.read(
         path=src_path,
         schema="nexus",
         suppress_internal_node_taxa=
         False,  # so internal labels get translated
     )
     self.assertEqual(result, (1, 7, 4))
     self.verify_dataset(ds)
 def testMultiTaxonNamespace(self):
     d = dendropy.DataSet()
     d.read(path=pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'), schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.mle.nex'), schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 2)
     self.assertEqual(len(d.taxon_namespaces[1]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.reference-trees.newick'), schema="newick")
     self.assertEqual(len(d.taxon_namespaces), 3)
     self.assertEqual(len(d.taxon_namespaces[2]), 33)
     d.read(path=pathmap.char_source_path('caenophidia_mos.chars.fasta'), schema="fasta", data_type="protein")
     self.assertEqual(len(d.taxon_namespaces), 4)
     self.assertEqual(len(d.taxon_namespaces[3]), 114)
 def testBoundTaxonNamespaceDefault(self):
     d = dendropy.DataSet()
     t = dendropy.TaxonNamespace()
     d.attach_taxon_namespace(t)
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertIs(d.taxon_namespaces[0], d.attached_taxon_namespace)
     d.read(path=pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'), schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.mle.nex'), schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.reference-trees.newick'), schema="newick")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.char_source_path('caenophidia_mos.chars.fasta'), schema="fasta", data_type="protein")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 147)
 def testAttachTaxonNamespaceOnGet(self):
     t = dendropy.TaxonNamespace()
     d = dendropy.DataSet.get_from_path(pathmap.mixed_source_path('reference_single_taxonset_dataset.nex'),
             "nexus",
             taxon_namespace=t)
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertIsNot(d.attached_taxon_namespace, None)
     self.assertIs(d.taxon_namespaces[0], d.attached_taxon_namespace)
     self.assertIs(d.attached_taxon_namespace, t)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.mle.nex'), schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.reference-trees.newick'), schema="newick")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.detach_taxon_namespace()
     d.read_from_path(pathmap.char_source_path('caenophidia_mos.chars.fasta'), schema="fasta", data_type="protein")
     self.assertEqual(len(d.taxon_namespaces), 2)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     self.assertEqual(len(d.taxon_namespaces[1]), 114)
 def testMultiTaxonNamespace(self):
     d = dendropy.DataSet()
     d.read(path=pathmap.mixed_source_path(
         'reference_single_taxonset_dataset.nex'),
            schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 1)
     self.assertEqual(len(d.taxon_namespaces[0]), 33)
     d.read(path=pathmap.tree_source_path('pythonidae.mle.nex'),
            schema="nexus")
     self.assertEqual(len(d.taxon_namespaces), 2)
     self.assertEqual(len(d.taxon_namespaces[1]), 33)
     d.read(
         path=pathmap.tree_source_path('pythonidae.reference-trees.newick'),
         schema="newick")
     self.assertEqual(len(d.taxon_namespaces), 3)
     self.assertEqual(len(d.taxon_namespaces[2]), 33)
     d.read(path=pathmap.char_source_path('caenophidia_mos.chars.fasta'),
            schema="fasta",
            data_type="protein")
     self.assertEqual(len(d.taxon_namespaces), 4)
     self.assertEqual(len(d.taxon_namespaces[3]), 114)
 def get_source_dataset(self, **kwargs):
     src_ds = dendropy.DataSet.get_from_path(
         pathmap.mixed_source_path("standard-test-mixed.1.basic.nexus"),
         "nexus", **kwargs)
     return src_ds
 def test_default(self):
     ds = dendropy.DataSet.get_from_path(
         pathmap.mixed_source_path('multitaxa_mesquite.nex'), "nexus")
     self.verify_unrestricted(ds)
 def test_default(self):
     ds = dendropy.DataSet.get_from_path(
             pathmap.mixed_source_path('multitaxa_mesquite.nex'),
             "nexus")
     self.verify_unrestricted(ds)