-
Notifications
You must be signed in to change notification settings - Fork 30
/
test_gpiwriter.py
31 lines (26 loc) · 963 Bytes
/
test_gpiwriter.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
import io
from ontobio.io import entitywriter, gafgpibridge
def test_header_newline():
gpi_obj = {
'id': "MGI:MGI:1918911",
'label': "0610005C13Rik", # db_object_symbol,
'full_name': "RIKEN cDNA 0610005C13 gene", # db_object_name,
'synonyms': [],
'type': ["gene"], # db_object_type,
'parents': "", # GAF does not have this field, but it's optional in GPI
'xrefs': "", # GAF does not have this field, but it's optional in GPI
'taxon': {
'id': "NCBITaxon:10090"
}
}
entity = gafgpibridge.Entity(gpi_obj)
out = io.StringIO()
gpiwriter = entitywriter.GpiWriter(file=out)
gpiwriter.write_entity(entity)
outlines = out.getvalue().split("\n")
expected_lines = [
"!gpi-version: 1.2",
"MGI\tMGI:1918911\t0610005C13Rik\tRIKEN cDNA 0610005C13 gene\t\tgene\ttaxon:10090\t\t\t",
""
]
assert expected_lines == outlines