コード例 #1
0
    def pipeline_doaj(self):
        xylose_article = Article(self._article, iso_format='iso 639-2')

        ppl = plumber.Pipeline(export_doaj.SetupArticlePipe(),
                               export_doaj.XMLArticlePipe(),
                               export_doaj.XMLJournalMetaPublisherPipe(),
                               export_doaj.XMLJournalMetaJournalTitlePipe(),
                               export_doaj.XMLJournalMetaISSNPipe(),
                               export_doaj.XMLArticleMetaPublicationDatePipe(),
                               export_doaj.XMLArticleMetaVolumePipe(),
                               export_doaj.XMLArticleMetaIssuePipe(),
                               export_doaj.XMLArticleMetaStartPagePipe(),
                               export_doaj.XMLArticleMetaEndPagePipe(),
                               export_doaj.XMLArticleMetaArticleIdDOIPipe(),
                               export_doaj.XMLArticleMetaIdPipe(),
                               export_doaj.XMLArticleMetaDocumentTypePipe(),
                               export_doaj.XMLArticleMetaTitlePipe(),
                               export_doaj.XMLArticleMetaAuthorsPipe(),
                               export_doaj.XMLArticleMetaAffiliationPipe(),
                               export_doaj.XMLArticleMetaAbstractsPipe(),
                               export_doaj.XMLArticleMetaFullTextUrlPipe(),
                               export_doaj.XMLArticleMetaKeywordsPipe(),
                               export_doaj.XMLClosePipe())

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

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

        del (self._article_meta.data['issue']['issue']['v31'])

        pxml = ET.Element('records')
        pxml.append(ET.Element('record'))

        data = [self._article_meta, pxml]

        xmlarticle = export_doaj.XMLArticleMetaVolumePipe()
        raw, xml = xmlarticle.transform(data)

        self.assertIsNone(xml.find('./record/volume'))
コード例 #3
0
    def test_xmlarticle_meta_general_info_volume_pipe(self):

        pxml = ET.Element('records')
        pxml.append(ET.Element('record'))

        data = [self._article_meta, pxml]

        xmlarticle = export_doaj.XMLArticleMetaVolumePipe()
        raw, xml = xmlarticle.transform(data)

        startpage = xml.find('./record/volume').text

        self.assertEqual(u'44', startpage)
コード例 #4
0
    def test_xmlarticle_meta_general_info_volume_without_data_pipe(self):

        del (self._article_meta.data['issue']['issue']['v31'])

        pxml = ET.Element('records')
        pxml.append(ET.Element('record'))

        data = [self._article_meta, pxml]

        xmlarticle = export_doaj.XMLArticleMetaVolumePipe()
        raw, xml = xmlarticle.transform(data)

        try:
            xml.find('./record/volume').text
        except AttributeError:
            self.assertTrue(True)
        else:
            self.assertTrue(False)
コード例 #5
0
    def test_xmlarticle_meta_general_info_volume_without_data_pipe(self):

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

        pxml = ET.Element('records')
        pxml.append(ET.Element('record'))

        data = [fakexylosearticle, pxml]

        xmlarticle = export_doaj.XMLArticleMetaVolumePipe()
        raw, xml = xmlarticle.transform(data)

        try:
            xml.find('./record/volume').text
        except AttributeError:
            self.assertTrue(True)
        else:
            self.assertTrue(False)