def test_generate(self): for ( article_xml_file, crossref_xml_file, config_section, pub_date, ) in self.passes: file_path = TEST_DATA_PATH + article_xml_file articles = generate.build_articles_for_crossref([file_path]) crossref_config = None if config_section: crossref_config = create_crossref_config(config_section) # generate pretty XML crossref_xml = generate.crossref_xml(articles, crossref_config, pub_date, False, pretty=True, indent="\t") model_crossref_xml = read_file_content(TEST_DATA_PATH + crossref_xml_file) if sys.version_info < (3, 8): # pre Python 3.8 tag attributes are in a different order model_crossref_xml = replace_namespaces(model_crossref_xml) self.assertEqual( crossref_xml, model_crossref_xml.decode("utf-8"), "Failed parse test on file %s" % article_xml_file, )
def setUp(self): self.crossref_config = create_crossref_config() self.article = Article() article_license = License() article_license.href = "https://example.org" self.article.license = article_license self.parent = Element("crossmark")
def test_parse_do_no_pass_pub_date(self): """ For test coverage build a crossrefXML object without passing in a pub_date """ article_xml_file = "elife_poa_e02725.xml" file_path = TEST_DATA_PATH + article_xml_file articles = generate.build_articles_for_crossref([file_path]) crossref_config = create_crossref_config("elife") crossref_object = generate.CrossrefXML(articles, crossref_config, None, True) self.assertIsNotNone(crossref_object.pub_date) self.assertIsNotNone(crossref_object.generated) self.assertIsNotNone( [tag for tag in crossref_object.root.iter() if tag is Comment]) self.assertIsNotNone(crossref_object.output_xml())
def test_generate_jats_abstract_face_markup(self): """ For coverage test JATS and inline output by overriding the config """ article_xml_file = "elife-16988-v1.xml" file_path = TEST_DATA_PATH + article_xml_file articles = generate.build_articles_for_crossref([file_path]) crossref_config = create_crossref_config("elife") # override config values crossref_config["jats_abstract"] = True crossref_config["face_markup"] = True # create the Crossref XML crossref_object = generate.CrossrefXML(articles, crossref_config, None, True) # Check for some tags we expect to find in the output self.assertTrue("<jats:italic>" in crossref_object.output_xml()) self.assertTrue("</b>" in crossref_object.output_xml())
def setUp(self): self.crossref_config = create_crossref_config()
def setUp(self): self.crossref_config = create_crossref_config() self.article = Article()
def setUp(self): self.crossref_config = create_crossref_config() self.article = Article("10.7554/eLife.00666") self.parent = Element("journal_article")