-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_QueryDisont.py
64 lines (51 loc) · 2.64 KB
/
test_QueryDisont.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import unittest
from QueryDisont import QueryDisont
class QueryDisontTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.disont = QueryDisont()
def test_query_disont_to_child_disonts(self):
bte_result = self.disont.query_disont_to_child_disonts("DOID:9352")
rtx_result = {1837, 10182, 11712}
self.assertSetEqual(bte_result, rtx_result)
bte_result = self.disont.query_disont_to_child_disonts("DOID:12365")
rtx_result = {12919, 12978, 14067, 14068, 14069, 14324, 14325}
self.assertSetEqual(bte_result, rtx_result)
def test_query_disont_to_child_disonts_desc(self):
# RTX gets {'DOID:11712': 'lipoatrophic diabetes'} while
# BioThings Explorer gets {'DOID:11712': 'lipoatrophic diabetes mellitus'}
# bte_result = self.disont.query_disont_to_child_disonts_desc("DOID:9352")
# rtx_result = {'DOID:10182': 'diabetic peripheral angiopathy',
# 'DOID:11712': 'lipoatrophic diabetes',
# 'DOID:1837': 'diabetic ketoacidosis'}
# print(bte_result)
# self.assertEqual(len(bte_result), len(rtx_result))
# for key, value in bte_result.items():
# self.assertEqual(rtx_result[key], value)
bte_result = self.disont.query_disont_to_child_disonts_desc("DOID:12365")
rtx_result = {'DOID:12919': 'Plasmodium ovale malaria',
'DOID:12978': 'Plasmodium vivax malaria',
'DOID:14067': 'Plasmodium falciparum malaria',
'DOID:14068': 'blackwater fever',
'DOID:14069': 'cerebral malaria',
'DOID:14324': 'Plasmodium malariae malaria',
'DOID:14325': 'mixed malaria'}
self.assertEqual(len(bte_result), len(rtx_result))
for key, value in bte_result.items():
self.assertEqual(rtx_result[key], value)
def test_query_disont_to_label(self):
bte_result = self.disont.query_disont_to_label("DOID:0050741")
rtx_result = 'alcohol dependence'
self.assertEqual(bte_result, rtx_result)
bte_result = self.disont.query_disont_to_label("DOID:12365")
rtx_result = 'malaria'
self.assertEqual(bte_result, rtx_result)
def test_query_disont_to_mesh_id(self):
bte_result = self.disont.query_disont_to_mesh_id("DOID:9352")
rtx_result = {'D003924'}
self.assertSetEqual(bte_result, rtx_result)
bte_result = self.disont.query_disont_to_mesh_id("DOID:1837")
rtx_result = {'D016883'}
self.assertSetEqual(bte_result, rtx_result)
if __name__ == '__main__':
unittest.main()