Class | ETreeETXPathClassTestCase |
Tests for the ETXPath class |
Class | ETreeXPathClassTestCase |
Tests for the XPath class |
Class | ETreeXPathExsltTestCase |
Tests for the EXSLT support in XPath (requires libxslt 1.1.25+) |
Class | ETreeXPathTestCase |
XPath tests etree |
Function | argsTest1 |
Undocumented |
Function | argsTest2 |
Undocumented |
Function | booleanTest |
Undocumented |
Function | floatTest |
Undocumented |
Function | resultTypesTest |
Undocumented |
Function | resultTypesTest2 |
Undocumented |
Function | setTest |
Undocumented |
Function | setTest2 |
Undocumented |
Function | stringListTest |
Undocumented |
Function | stringTest |
Undocumented |
Function | tag |
Undocumented |
Function | tag_or_value |
Undocumented |
Function | test_suite |
Undocumented |
Function | xpath |
Test xpath extension functions. |
Constant | SAMPLE_XML |
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 |
|