Skip to content

Commit

Permalink
Fix Newick format using internal IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
audy authored Sep 18, 2023
2 parents aa46989 + 2a2fde3 commit db51da5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ impl Taxonomy {
py_try!(newick::save(
&mut bytes,
&self.tax,
Some(TaxonomyTrait::<InternalIndex>::root(&self.tax))
Some(TaxonomyTrait::<&str>::root(&self.tax))
));
Ok(PyBytes::new(py, &bytes).into())
}
Expand Down
6 changes: 6 additions & 0 deletions test_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ def test_can_clone(self):
self.assertIsNotNone(tax2.node("E"))
self.assertEqual(len(tax2), 6)

def test_output_uses_tax_ids(self):
res = self.tax.to_newick().decode("utf-8")

for tax_id in ["A", "B", "C", "D", "E", "F"]:
assert tax_id in res


class NCBITestCase(unittest.TestCase):
def _create_tax(self):
Expand Down

0 comments on commit db51da5

Please sign in to comment.