se adiciona FachoXml.get_element_text_or_attribute

FossilOrigin-Name: 2179f4376613dda1e554a4f1304990f32185c1ec9bec6181d8a00e31a5ee5390
This commit is contained in:
bit4bit
2021-11-06 20:43:07 +00:00
parent 35e1c5b609
commit 8d17c282e3
4 changed files with 45 additions and 16 deletions

View File

@@ -362,3 +362,11 @@ def test_facho_xml_exist_element():
xml.find_or_create_element('./A')
assert xml.exist_element('/root/A') == True
assert xml.tostring() == '<root><A/></root>'
def test_facho_xml_query_element_text_or_attribute():
xml = facho.FachoXML('root')
xml.set_element('./A', 'contenido', clave='valor')
assert xml.get_element_text_or_attribute('/root/A') == 'contenido'
assert xml.get_element_text_or_attribute('/root/A/@clave') == 'valor'