Exemplo n.º 1
0
    def pipeline_pubmed(self):
        xylose_article = Article(self._article, iso_format='iso 639-2')

        ppl = plumber.Pipeline(export_pubmed.SetupArticleSetPipe(),
                               export_pubmed.XMLArticlePipe(),
                               export_pubmed.XMLJournalPipe(),
                               export_pubmed.XMLPublisherNamePipe(),
                               export_pubmed.XMLJournalTitlePipe(),
                               export_pubmed.XMLISSNPipe(),
                               export_pubmed.XMLVolumePipe(),
                               export_pubmed.XMLIssuePipe(),
                               export_pubmed.XMLPubDatePipe(),
                               export_pubmed.XMLReplacesPipe(),
                               export_pubmed.XMLArticleTitlePipe(),
                               export_pubmed.XMLFirstPagePipe(),
                               export_pubmed.XMLLastPagePipe(),
                               export_pubmed.XMLElocationIDPipe(),
                               export_pubmed.XMLLanguagePipe(),
                               export_pubmed.XMLAuthorListPipe(),
                               export_pubmed.XMLPublicationTypePipe(),
                               export_pubmed.XMLArticleIDListPipe(),
                               export_pubmed.XMLHistoryPipe(),
                               export_pubmed.XMLAbstractPipe(),
                               export_pubmed.XMLClosePipe())

        transformed_data = ppl.run(xylose_article, rewrap=True)

        return next(transformed_data)
Exemplo n.º 2
0
    def test_xmlissue_pipe(self):

        pxml = ET.Element('ArticleSet')
        pxml.append(ET.Element('Article'))

        article = pxml.find('Article')
        article.append(ET.Element('Journal'))

        data = [self._article_meta, pxml]

        xmlarticle = export_pubmed.XMLIssuePipe()
        raw, xml = xmlarticle.transform(data)

        issue = xml.find('./Article/Journal/Issue').text

        self.assertEqual(u'4', issue)
Exemplo n.º 3
0
    def test_issue_element(self):
        _raw_json = {
            'issue': {
                'issue': {
                    'v32': [{
                        '_': '10'
                    }]
                },
            },
            'article': {
                'v32': [{
                    '_': '10'
                }]
            },
        }
        _article = Article(_raw_json)

        data = [_article, self.xml]

        _xml = export_pubmed.XMLIssuePipe()
        raw, xml = _xml.transform(data)

        self.assertEqual(xml.findtext('.//Journal/Issue'), '10')
Exemplo n.º 4
0
    def test_aop_element(self):
        _raw_json = {
            'issue': {
                'issue': {
                    'v32': [{
                        '_': 'ahead'
                    }]
                },
            },
            'article': {
                'v32': [{
                    '_': 'ahead'
                }]
            },
        }
        _article = Article(_raw_json)

        data = [_article, self.xml]

        _xml = export_pubmed.XMLIssuePipe()
        raw, xml = _xml.transform(data)

        self.assertIsNone(xml.find('.//Journal/Volume'))
        self.assertIsNone(xml.find('.//Journal/Issue'))