aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2002-03-05 15:41:29 +0000
committerDaniel Veillard <veillard@src.gnome.org>2002-03-05 15:41:29 +0000
commit8d24cc189845663509623fbd6b5106cc01266994 (patch)
tree2d97c640f3313d1592eb90e4fc224ca18315834c /python/tests
parentba5e18a3fba71a36c6addcaa3d25a04ac264ec77 (diff)
downloadandroid_external_libxml2-8d24cc189845663509623fbd6b5106cc01266994.tar.gz
android_external_libxml2-8d24cc189845663509623fbd6b5106cc01266994.tar.bz2
android_external_libxml2-8d24cc189845663509623fbd6b5106cc01266994.zip
make sure SAX endDocument is always called as this could result in a
* parser.c: make sure SAX endDocument is always called as this could result in a Python memory leak otherwise (it's used to decrement ref-counting) * python/generator.py python/libxml.c python/libxml.py python/libxml2-python-api.xml python/libxml2class.txt python/tests/error.py python/tests/xpath.py: implemented the suggestions made by Gary Benson and extended the tests to match it. Daniel
Diffstat (limited to 'python/tests')
-rwxr-xr-xpython/tests/error.py16
-rwxr-xr-xpython/tests/xpath.py8
2 files changed, 22 insertions, 2 deletions
diff --git a/python/tests/error.py b/python/tests/error.py
index 93379450..cc771de1 100755
--- a/python/tests/error.py
+++ b/python/tests/error.py
@@ -16,8 +16,17 @@ def callback(ctx, str):
err = err + "%s %s" % (ctx, str)
+got_exc = 0
libxml2.registerErrorHandler(callback, "-->")
-doc = libxml2.parseFile("missing.xml")
+try:
+ doc = libxml2.parseFile("missing.xml")
+except libxml2.parserError:
+ got_exc = 1
+
+if got_exc == 0:
+ print "Failed to get a parser exception"
+ sys.exit(1)
+
if err != expect:
print "error"
print "received %s" %(err)
@@ -26,7 +35,10 @@ if err != expect:
i = 10000
while i > 0:
- doc = libxml2.parseFile("missing.xml")
+ try:
+ doc = libxml2.parseFile("missing.xml")
+ except libxml2.parserError:
+ got_exc = 1
err = ""
i = i - 1
diff --git a/python/tests/xpath.py b/python/tests/xpath.py
index 73ab735e..2e036e1f 100755
--- a/python/tests/xpath.py
+++ b/python/tests/xpath.py
@@ -22,6 +22,14 @@ if len(res) != 2:
if res[0].name != "doc" or res[1].name != "foo":
print "xpath query: wrong node set value"
sys.exit(1)
+ctxt.setContextNode(res[0])
+res = ctxt.xpathEval("foo")
+if len(res) != 1:
+ print "xpath query: wrong node set size"
+ sys.exit(1)
+if res[0].name != "foo":
+ print "xpath query: wrong node set value"
+ sys.exit(1)
doc.freeDoc()
ctxt.xpathFreeContext()
i = 1000