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)
def test_xmlarticle_meta_affiliation_index_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.XMLArticleMetaAffiliationPipe() raw, xml = xmlarticle.transform(data) indexes = sorted( [i.get('id') for i in xml.findall('./front/article-meta/aff')]) self.assertEqual(sorted([u'aff01', u'aff02', u'aff03']), indexes)
def test_xmlarticle_meta_affiliation_address_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.XMLArticleMetaAffiliationPipe() raw, xml = xmlarticle.transform(data) address = sorted([i.text for i in xml.findall('./front/article-meta/aff/addr-line/named-content[@content-type="city"]')]) self.assertEqual(sorted([u'Belo Horizonte', u'São Paulo', u'Belo Horizonte']), address)
def test_xmlarticle_meta_affiliation_country_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.XMLArticleMetaAffiliationPipe() raw, xml = xmlarticle.transform(data) countries = [i.find('country').text for i in xml.findall('./front/article-meta/aff')] self.assertEqual([u'BRAZIL', u'BRAZIL', u'BRAZIL'], countries)
def test_xmlarticle_meta_affiliation_institution_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.XMLArticleMetaAffiliationPipe() raw, xml = xmlarticle.transform(data) affiliations = sorted([i.find('institution').text for i in xml.findall('./front/article-meta/aff')]) self.assertEqual(sorted([u'Universidade Federal de Minas Gerais', u'Universidade Federal de São Paulo', u'Universidade Federal de Minas Gerais']), affiliations)
def test_xmlarticle_meta_affiliation_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.XMLArticleMetaAffiliationPipe() raw, xml = xmlarticle.transform(data) affiliations = [i.find('institution').text for i in xml.findall('./front/article-meta/aff')] self.assertEqual([], affiliations)