예제 #1
0
 def PublicationType(self, element):
     if element.text:
         return PublicationType(self.pmid, element.text.strip())
예제 #2
0
from medic.orm import Medline, Section, Author, Descriptor, Qualifier, Database, Identifier, \
        Chemical, Keyword, PublicationType
from medic.crud import _dump

DATA = [
    Section(1, 1, 'Title', 'The Title'),
    Section(1, 2, 'Abstract', 'The Abstract'),
    Descriptor(1, 1, 'd_name', True),
    Descriptor(1, 2, 'd_name'),
    Qualifier(1, 1, 1, 'q_name', True),
    Author(1, 1, 'first'),
    Author(1, 2, 'last'),
    Identifier(1, 'ns', 'id'),
    Database(1, 'name', 'accession'),
    PublicationType(1, 'some'),
    PublicationType(1, 'another'),
    Chemical(1, 1, 'name', 'uid'),
    Keyword(1, 'NOTNLM', 1, 'name', True),
    Medline(1, 'MEDLINE', 'journal', 'pub_date', date.today()),
]


class ParserMock:
    def __init__(self, instances):
        self.instances = instances

    def parse(self, _):
        for i in self.instances:
            yield i
예제 #3
0
 def testToRepr(self):
     self.assertEqual('PublicationType<1:type>',
                      repr(PublicationType(1, 'type')))
예제 #4
0
 def testRelations(self):
     i = PublicationType(1, 'type')
     self.sess.add(i)
     self.sess.commit()
     self.assertEqual([i], self.M.publication_types)
     self.assertEqual(self.M, i.citation)
예제 #5
0
 def testToString(self):
     self.assertEqual('1\ttype\n', str(PublicationType(1, 'type')))