Skip to content

Commit 06e0f14

Browse files
committed
python: add tests for stdlib xpath
1 parent f55d7d6 commit 06e0f14

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
match = "dc:title"
2+
ns = {'dc': 'http://purl.org/dc/elements/1.1/'}
3+
4+
import xml.etree.ElementTree as ET
5+
tree = ET.parse('country_data.xml')
6+
root = tree.getroot()
7+
8+
root.find(match, namespaces=ns) # $ MISSING: getXPath=match
9+
root.findall(match, namespaces=ns) # $ MISSING: getXPath=match
10+
root.findtext(match, default=None, namespaces=ns) # $ MISSING: getXPath=match
11+
12+
from xml.etree.ElementTree import ElementTree
13+
tree = ElementTree()
14+
tree.parse("index.xhtml")
15+
16+
tree.find(match, namespaces=ns) # $ MISSING: getXPath=match
17+
tree.findall(match, namespaces=ns) # $ MISSING: getXPath=match
18+
tree.findtext(match, default=None, namespaces=ns) # $ MISSING: getXPath=match

0 commit comments

Comments
 (0)