facho/facho.xml (FachoXML.get_element_text): usa xpath de lxml para consulta
FossilOrigin-Name: ddd3843510da9f31ba5963f8a119b689bfee3a62db572dffed14d623a5a0c761
This commit is contained in:
@@ -139,4 +139,16 @@ def test_facho_xml_get_element_text():
|
||||
line.set_element('/Line/Quantity', 5)
|
||||
assert line.get_element_text('/Line/Quantity', format_=int) == 5
|
||||
|
||||
def test_facho_xml_get_element_text_next_child():
|
||||
xml = facho.FachoXML('Invoice')
|
||||
xml.set_element('/Invoice/ID', 'ABC123')
|
||||
|
||||
assert xml.get_element_text('/Invoice/ID') == 'ABC123'
|
||||
|
||||
line = xml.fragment('/Invoice/Line')
|
||||
line.set_element('/Line/Quantity', 5)
|
||||
line = xml.fragment('/Invoice/Line', append=True)
|
||||
line.set_element('/Line/Quantity', 6)
|
||||
assert line.get_element_text('/Line[2]/Quantity', format_=int) == 6
|
||||
|
||||
|
||||
|
||||
@@ -106,3 +106,4 @@ def test_invoicesimple_zip(simple_invoice):
|
||||
with zipfile.ZipFile(zipdata) as dianzip:
|
||||
xml_data = dianzip.open(name_invoice).read().decode('utf-8')
|
||||
assert xml_data == str(xml_invoice)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user