Ejemplo n.º 1
0
 def test_remove_styles_off_tagged_content_removes_bold_because_it_wraps_whole_source(
         self):
     text = "<root><source><italic><bold>texto 1</bold> <bold>texto 2</bold></italic></source></root>"
     expected = "<root><source><italic>texto 1 texto 2</italic></source></root>"
     obj = sps_pkgmaker.SPSXMLContent(text)
     obj.remove_styles_off_tagged_content("source")
     self.assertEqual(obj.content, expected)
Ejemplo n.º 2
0
 def test_remove_uri_off_contrib_id_without_contrib_id(self):
     text = """<contrib-group>
     <contrib contrib-type="author">
         <contrib-id contrib-id-type="orcid"/>
         <name>
             <surname>Einstein</surname>
             <given-names>Albert</given-names>
         </name>
     </contrib>
     <contrib contrib-type="author">
         <contrib-id contrib-id-type="lattes">https://lattes.cnpq.br/4760273612238540</contrib-id>
         <name>
             <surname>Meneghini</surname>
             <given-names>Rogerio</given-names>
         </name>
     </contrib></contrib-group>"""
     obj = sps_pkgmaker.SPSXMLContent(text)
     obj.remove_uri_off_contrib_id()
     self.assertEqual(['4760273612238540'], [
         contrib_id.text for contrib_id in obj.xml.findall(".//contrib-id")
         if contrib_id.text
     ])
Ejemplo n.º 3
0
 def test_remove_uri_off_contrib_id(self):
     text = """<contrib-group>
     <contrib contrib-type="author">
         <contrib-id contrib-id-type="orcid">https://orcid.org/0000-0001-8528-2091</contrib-id>
         <contrib-id contrib-id-type="scopus">https://www.scopus.com/authid/detail.uri?authorId=24771926600</contrib-id>
         <name>
             <surname>Einstein</surname>
             <given-names>Albert</given-names>
         </name>
     </contrib>
     <contrib contrib-type="author">
         <contrib-id contrib-id-type="lattes">https://lattes.cnpq.br/4760273612238540</contrib-id>
         <name>
             <surname>Meneghini</surname>
             <given-names>Rogerio</given-names>
         </name>
     </contrib></contrib-group>"""
     obj = sps_pkgmaker.SPSXMLContent(text)
     obj.remove_uri_off_contrib_id()
     self.assertEqual(
         ['0000-0001-8528-2091', '24771926600', '4760273612238540'], [
             contrib_id.text
             for contrib_id in obj.xml.findall(".//contrib-id")
         ])
Ejemplo n.º 4
0
 def test_remove_styles_off_tagged_content_does_not_remove_italic(self):
     text = "<root><source><bold> <italic>texto 1</italic> sem estilo <italic>texto 2</italic> </bold></source></root>"
     expected = "<root><source> <italic>texto 1</italic> sem estilo <italic>texto 2</italic> </source></root>"
     obj = sps_pkgmaker.SPSXMLContent(text)
     obj.remove_styles_off_tagged_content("source")
     self.assertEqual(obj.content, expected)
Ejemplo n.º 5
0
 def test_remove_styles_off_tagged_content_does_not_remove_bold(self):
     text = "<root><source>texto 1 <bold>texto bold</bold> texto 2</source></root>"
     obj = sps_pkgmaker.SPSXMLContent(text)
     obj.remove_styles_off_tagged_content("source")
     self.assertEqual(obj.content, text)
Ejemplo n.º 6
0
 def test_remove_styles_off_tagged_content_removes_all_bolds(self):
     text = "<root><source><bold>texto 1</bold> <bold>texto 2</bold></source></root>"
     expected = "<root><source>texto 1 texto 2</source></root>"
     obj = sps_pkgmaker.SPSXMLContent(text)
     obj.remove_styles_off_tagged_content("source")
     self.assertEqual(obj.content, expected)