def test_get_style_node_by_name(self): idml_file = IDMLPackage(os.path.join(IDMLFILES_DIR, "article-1photo_import-xml.idml"), mode="r") style = Style(idml_file) style_node = style.get_style_node_by_name("CharacterStyle/bold") self.assertEqual( style_node.nsmap, {'idPkg': 'http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging'}) self.assertEqual( etree_dom_to_tree(style_node, True), { 'attrs': { 'FontStyle': 'Bold', 'Imported': 'false', 'KeyboardShortcut': '0 0', 'Name': 'bold', 'Self': 'CharacterStyle/bold' }, 'content': [{ 'attrs': {}, 'content': [{ 'attrs': { 'type': 'string' }, 'content': [], 'tag': 'BasedOn', 'tail': '', 'text': '$ID/[No character style]' }, { 'attrs': { 'type': 'enumeration' }, 'content': [], 'tag': 'PreviewColor', 'tail': '', 'text': 'Nothing' }], 'tag': 'Properties', 'tail': '', 'text': '' }], 'tag': 'CharacterStyle', 'tail': '', 'text': '' })
def test_get_style_node_by_name(self): idml_file = IDMLPackage(os.path.join(IDMLFILES_DIR, "article-1photo_import-xml.idml"), mode="r") style = Style(idml_file) style_node = style.get_style_node_by_name("CharacterStyle/bold") self.assertEqual(style_node.nsmap, {'idPkg': 'http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging'}) self.assertEqual(etree_dom_to_tree(style_node, True), { 'attrs': { 'FontStyle': 'Bold', 'Imported': 'false', 'KeyboardShortcut': '0 0', 'Name': 'bold', 'Self': 'CharacterStyle/bold' }, 'content': [ { 'attrs': {}, 'content': [ { 'attrs': {'type': 'string'}, 'content': [], 'tag': 'BasedOn', 'tail': '', 'text': '$ID/[No character style]' }, { 'attrs': {'type': 'enumeration'}, 'content': [], 'tag': 'PreviewColor', 'tail': '', 'text': 'Nothing' } ], 'tag': 'Properties', 'tail': '', 'text': '' } ], 'tag': 'CharacterStyle', 'tail': '', 'text': '' })