def test_component_subtitle_with_face_markup(self): """build an article object and component, generate Crossref XML""" doi = "10.7554/eLife.00666" title = "Test article" article = Article(doi, title) component = Component() component.title = "A component" component.subtitle = ( "A <sc>STRANGE</sc> <italic>subtitle</italic>, " + "and this tag is <not_allowed>!</not_allowed>") expected_subtitle = ( "A <sc>STRANGE</sc> <i>subtitle</i>, and this tag " + "is <not_allowed>!</not_allowed>") article.component_list = [component] # load a config and override the value raw_config_object = raw_config("elife") face_markup = raw_config_object.get("face_markup") raw_config_object["face_markup"] = "true" crossref_config = parse_raw_config(raw_config_object) # generate the crossrefXML c_xml = generate.CrossrefXML([article], crossref_config, None, True) crossref_xml_string = c_xml.output_xml() self.assertIsNotNone(crossref_xml_string) # A quick test just look for the expected string to test for tags and escape characters self.assertTrue(expected_subtitle in crossref_xml_string) # now set the config back to normal raw_config_object["face_markup"] = face_markup
def test_component_subtitle_no_face_markup(self): """build an article object and component, generate Crossref XML""" doi = "10.7554/eLife.00666" title = "Test article" article = Article(doi, title) component = Component() component.title = "A component" component.subtitle = ( "A <sc>STRANGE</sc> <italic>subtitle</italic>, " + "and this tag is <not_allowed>!</not_allowed>") expected_subtitle = ("A STRANGE subtitle, and this tag is" " <not_allowed>!</not_allowed>") article.component_list = [component] # generate the crossrefXML c_xml = generate.build_crossref_xml([article]) crossref_xml_string = c_xml.output_xml() self.assertIsNotNone(crossref_xml_string) # A quick test just look for the expected string to test for tags and escape characters self.assertTrue(expected_subtitle in crossref_xml_string)