Commit 6bb1c8a1 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Fix bug: Entry without comments causes exceptions

parent 563015e3
......@@ -71,9 +71,13 @@ def read_annotation(entry):
annotation = {
'domain': entry.attrib['id'],
'accession': entry.attrib['accession'],
'terms' : [],
'comment': entry.find('pfam:comment', ns).text.strip()
'terms' : []
}
comment = entry.find('pfam:comment', ns)
if comment:
annotation['comment'] = comment.text.strip()
go_terms = entry.find('pfam:go_terms', ns)
if go_terms:
categories = go_terms.findall('pfam:category', ns)
......
import unittest
from dbxref import retriever, resolver
from dbxref.retrieve import pfam
class TestPfam(unittest.TestCase):
def test_no_go_terms(self):
'''regression test for missing go terms in pfam entry'''
documents = retriever.retrieve([{'db': 'pfam', 'id': 'PF10423.8'}])
def test_no_position(self):
'''regression test for missing comment in pfam entry'''
documents = pfam.retrieve([{'db': 'PFAM', 'id': 'PF00083.23'}])
# this test failed due to an error due to missing None handling,
# so no assertions here. Once fixed. this should suffice
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment