コード例 #1
0
    def pipeline_rsps(self):
        xylose_article = Article(self._article)

        ppl = plumber.Pipeline(
            export_rsps.SetupArticlePipe(), export_rsps.XMLArticlePipe(),
            export_rsps.XMLFrontPipe(),
            export_rsps.XMLJournalMetaJournalIdPipe(),
            export_rsps.XMLJournalMetaJournalTitleGroupPipe(),
            export_rsps.XMLJournalMetaISSNPipe(),
            export_rsps.XMLJournalMetaPublisherPipe(),
            export_rsps.XMLArticleMetaArticleIdPublisherPipe(),
            export_rsps.XMLArticleMetaArticleIdDOIPipe(),
            export_rsps.XMLArticleMetaArticleCategoriesPipe(),
            export_rsps.XMLArticleMetaTitleGroupPipe(),
            export_rsps.XMLArticleMetaTranslatedTitleGroupPipe(),
            export_rsps.XMLArticleMetaContribGroupPipe(),
            export_rsps.XMLArticleMetaAffiliationPipe(),
            export_rsps.XMLArticleMetaDatesInfoPipe(),
            export_rsps.XMLArticleMetaIssueInfoPipe(),
            export_rsps.XMLArticleMetaElocationInfoPipe(),
            export_rsps.XMLArticleMetaPagesInfoPipe(),
            export_rsps.XMLArticleMetaHistoryPipe(),
            export_rsps.XMLArticleMetaPermissionPipe(),
            export_rsps.XMLArticleMetaSelfUriPipe(),
            export_rsps.XMLArticleMetaAbstractsPipe(),
            export_rsps.XMLArticleMetaKeywordsPipe(),
            export_rsps.XMLArticleMetaCountsPipe(), export_rsps.XMLBodyPipe(),
            export_rsps.XMLArticleMetaCitationsPipe(),
            export_rsps.XMLSubArticlePipe(), export_rsps.XMLClosePipe())

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

        return next(transformed_data)
コード例 #2
0
    def test_xml_article_meta_article_id_doi_without_data_pipe(self):

        fakexylosearticle = Article({'article': {}, 'title': {}})

        pxml = ET.Element('article')
        pxml.append(ET.Element('front'))

        front = pxml.find('front')
        front.append(ET.Element('article-meta'))

        data = [fakexylosearticle, pxml]

        xmlarticle = export_rsps.XMLArticleMetaArticleIdDOIPipe()

        raw, xml = xmlarticle.transform(data)

        # This try except is a trick to test the expected result of the
        # piped XML, once the precond method don't raise an exception
        # we try to check if the preconditioned pipe was called or not.
        try:
            xml.find(
                './front/article-meta/article-id[@pub-id-type="doi"]').text
        except AttributeError:
            self.assertTrue(True)
        else:
            self.assertTrue(False)
コード例 #3
0
    def test_xml_article_meta_article_id_doi_pipe(self):

        pxml = ET.Element('article')
        pxml.append(ET.Element('front'))

        front = pxml.find('front')
        front.append(ET.Element('article-meta'))

        data = [self._article_meta, pxml]

        xmlarticle = export_rsps.XMLArticleMetaArticleIdDOIPipe()
        raw, xml = xmlarticle.transform(data)

        articleidpublisher = xml.find('./front/article-meta/article-id[@pub-id-type="doi"]').text

        self.assertEqual(u'10.1590/S0034-89102010000400007', articleidpublisher)