From c1533ac5d57429da329e4193768bd1dbfd41bcfa Mon Sep 17 00:00:00 2001 From: dengzq1234 Date: Thu, 30 May 2024 22:19:10 +0200 Subject: [PATCH] update sytanx for new test --- tests/test_ncbiquery.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/test_ncbiquery.py b/tests/test_ncbiquery.py index 0795b794..49178360 100644 --- a/tests/test_ncbiquery.py +++ b/tests/test_ncbiquery.py @@ -164,33 +164,33 @@ def test_get_topology(): def test_merged_id(): ncbi = NCBITaxa(dbfile=DATABASE_PATH) t1 = ncbi.get_lineage(649756) - self.assertEqual(t1, [1, 131567, 2, 1783272, 1239, 186801, 3085636, 186803, 207244, 649756]) + assert t1 == [1, 131567, 2, 1783272, 1239, 186801, 3085636, 186803, 207244, 649756] t2 = ncbi.get_lineage("649756") - self.assertEqual(t2, [1, 131567, 2, 1783272, 1239, 186801, 3085636, 186803, 207244, 649756]) + assert t2 == [1, 131567, 2, 1783272, 1239, 186801, 3085636, 186803, 207244, 649756] + def test_ignore_unclassified(): # normal case tree = PhyloTree('((9606, 9598), 10090);') tree.annotate_ncbi_taxa(taxid_attr='name', ignore_unclassified=False) - self.assertEqual(tree.common_ancestor(['9606', '9598']).props.get("sci_name"), 'Homininae') - self.assertEqual(tree.common_ancestor(['9606', '10090']).props.get("sci_name"), 'Euarchontoglires') + assert tree.common_ancestor(['9606', '9598']).props.get("sci_name") == 'Homininae' + assert tree.common_ancestor(['9606', '10090']).props.get("sci_name") == 'Euarchontoglires' + # empty case tree = PhyloTree('((9606, sample1), 10090);') tree.annotate_ncbi_taxa(taxid_attr='name', ignore_unclassified=False) - self.assertEqual(tree.common_ancestor(['9606', 'sample1']).props.get("sci_name"), '') - self.assertEqual(tree.common_ancestor(['9606', 'sample1']).props.get("rank"), 'Unknown') - self.assertEqual(tree.common_ancestor(['9606', '10090']).props.get("sci_name"), '') - + + assert tree.common_ancestor(['9606', 'sample1']).props.get("sci_name") == '' + assert tree.common_ancestor(['9606', 'sample1']).props.get("rank") == 'Unknown' + assert tree.common_ancestor(['9606', '10090']).props.get("sci_name") == '' + # ignore unclassified tree = PhyloTree('((9606, sample1), 10090);') tree.annotate_ncbi_taxa(taxid_attr='name', ignore_unclassified=True) - self.assertEqual(tree.common_ancestor(['9606', 'sample1']).props.get("sci_name"), 'Homo sapiens') - self.assertEqual(tree.common_ancestor(['9606', 'sample1']).props.get("rank"), 'species') - self.assertEqual(tree.common_ancestor(['9606', '10090']).props.get("sci_name"), 'Euarchontoglires') - t1 = ncbi.get_lineage(649756) - assert t1 == [1, 131567, 2, 1783272, 1239, 186801, 3085636, 186803, 207244, 649756] + assert tree.common_ancestor(['9606', 'sample1']).props.get("sci_name") == 'Homo sapiens' + assert tree.common_ancestor(['9606', 'sample1']).props.get("rank") == 'species' + assert tree.common_ancestor(['9606', '10090']).props.get("sci_name") == 'Euarchontoglires' + - t2 = ncbi.get_lineage('649756') - assert t2 == [1, 131567, 2, 1783272, 1239, 186801, 3085636, 186803, 207244, 649756]