Test cases related to XPath evaluation and the XPath class
Class |
|
Tests for the ETXPath class |
Class |
|
Tests for the XPath class |
Class |
|
Tests for the EXSLT support in XPath (requires libxslt 1.1.25+) |
Class |
|
XPath tests etree |
Function | args |
Undocumented |
Function | args |
Undocumented |
Function | boolean |
Undocumented |
Function | float |
Undocumented |
Function | result |
Undocumented |
Function | result |
Undocumented |
Function | set |
Undocumented |
Function | set |
Undocumented |
Function | string |
Undocumented |
Function | string |
Undocumented |
Function | tag |
Undocumented |
Function | tag |
Undocumented |
Function | test |
Undocumented |
Function | xpath |
Test xpath extension functions. |
Constant | SAMPLE |
Undocumented |
Variable | extension |
Undocumented |
Variable | uri |
Undocumented |
Test xpath extension functions. >>> root = SAMPLE_XML >>> e = etree.XPathEvaluator(root, extensions=[extension]) >>> e("stringTest('you')") 'Hello you' >>> e(_bytes("stringTest('\\xe9lan')").decode("unicode_escape")) u'Hello \xe9lan' >>> e("stringTest('you','there')") #doctest: +ELLIPSIS Traceback (most recent call last): ... TypeError: stringTest() takes... 2 ...arguments ... >>> e("floatTest(2)") 6.0 >>> e("booleanTest(true())") False >>> list(map(tag, e("setTest(/body/tag)"))) ['tag'] >>> list(map(tag, e("setTest2(/body/*)"))) ['tag', 'section'] >>> list(map(tag_or_value, e("stringListTest(/body/tag)"))) ['Hello ', 'tag', 'tag', 'tag', '!'] >>> e("argsTest1('a',1.5,true(),/body/tag)") "a, 1.5, True, ['tag', 'tag', 'tag']" >>> list(map(tag, e("argsTest2(/body/tag, /body/section)"))) ['tag', 'section', 'tag', 'tag'] >>> e("resultTypesTest()") Traceback (most recent call last): ... XPathResultError: This is not a supported node-set result: None >>> try: ... e("resultTypesTest2()") ... except etree.XPathResultError: ... print("Got error") Got error
Undocumented
Value |
|