obi test: better taxonomy testing

This commit is contained in:
Celine Mercier
2017-11-24 17:54:10 +01:00
parent 3ba7ce1c91
commit 38fef5b9d4

View File

@ -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'])+"%")