From 38fef5b9d4fb59fa071f59e6fee014cb7a69ffc7 Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Fri, 24 Nov 2017 17:54:10 +0100 Subject: [PATCH] obi test: better taxonomy testing --- python/obitools3/commands/test.pyx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/obitools3/commands/test.pyx b/python/obitools3/commands/test.pyx index c434dcc..2e7e8c6 100644 --- a/python/obitools3/commands/test.pyx +++ b/python/obitools3/commands/test.pyx @@ -51,8 +51,13 @@ def test_taxo(config, infos): for x in range(config['test']['nbtests']): idx = random.randint(0, len(tax1)-1) t1 = tax1.get_taxon_by_idx(idx) + taxid1 = t1.taxid t2 = tax2.get_taxon_by_idx(idx) - assert t1 == t2, "Taxon gotten from written taxonomy != taxon read from taxdump : "+str(t2)+" != "+str(t1) + taxid2 = t2.taxid + assert t1 == t2, "Taxon gotten from written taxonomy with index != taxon read from taxdump : "+str(t2)+" != "+str(t1) + t1 = tax1[taxid1] + t2 = tax2[taxid2] + assert t1 == t2, "Taxon gotten from written taxonomy with taxid != taxon read from taxdump : "+str(t2)+" != "+str(t1) i+=1 if (i%(config['test']['nbtests']/10)) == 0 : print("Testing taxonomy functions......"+str(i*100/config['test']['nbtests'])+"%")