mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
python: add tests for stdlib xpath
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
match = "dc:title"
|
||||
ns = {'dc': 'http://purl.org/dc/elements/1.1/'}
|
||||
|
||||
import xml.etree.ElementTree as ET
|
||||
tree = ET.parse('country_data.xml')
|
||||
root = tree.getroot()
|
||||
|
||||
root.find(match, namespaces=ns) # $ MISSING: getXPath=match
|
||||
root.findall(match, namespaces=ns) # $ MISSING: getXPath=match
|
||||
root.findtext(match, default=None, namespaces=ns) # $ MISSING: getXPath=match
|
||||
|
||||
from xml.etree.ElementTree import ElementTree
|
||||
tree = ElementTree()
|
||||
tree.parse("index.xhtml")
|
||||
|
||||
tree.find(match, namespaces=ns) # $ MISSING: getXPath=match
|
||||
tree.findall(match, namespaces=ns) # $ MISSING: getXPath=match
|
||||
tree.findtext(match, default=None, namespaces=ns) # $ MISSING: getXPath=match
|
||||
Reference in New Issue
Block a user