def testGetLineageInfoDoesNotCloseOpenDatabase(self): """ getLineageInfo should not close an open database it is passed. """ blastHits = BlastHits(None) blastHits.addHit("Smiley Cell Polyomavirus", {"taxID": 4}) db = FakeDbConnection([("species", 1), ("A")]) taxonomy.getLineageInfo(blastHits, db=db) self.assertEqual(True, db.open)
def testGetLineageInfo(self): """ getLineageInfo should return the right taxIDs from the database """ blastHits = BlastHits(None) blastHits.addHit("Smiley Cell Polyomavirus", {"taxID": 4}) db = FakeDbConnection([("species", 1), ("A")]) result = taxonomy.getLineageInfo(blastHits, db=db) self.assertEqual({4: [{"taxID": 4, "parentTaxID": 1, "rank": "species", "scientificName": "A"}]}, result)