mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-11 21:41:53 +03:00
more accessor classes for the parser context, allow to switch on and check
* python/TODO python/generator.py python/libxml2-python-api.xml python/libxml2class.txt: more accessor classes for the parser context, allow to switch on and check validity * python/tests/Makefile.am python/tests/error.py python/tests/invalid.xml python/tests/valid.xml python/tests/validate.py: attded more test and and added error.py which I forgot to commit in the last step Daniel
This commit is contained in:
30
python/tests/error.py
Executable file
30
python/tests/error.py
Executable file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/python -u
|
||||
#
|
||||
# This test exercise the redirection of error messages with a
|
||||
# functions defined in Python.
|
||||
#
|
||||
import sys
|
||||
import libxml2
|
||||
|
||||
expect='--> warning: --> failed to load external entity "missing.xml"\n'
|
||||
err=""
|
||||
def callback(ctx, str):
|
||||
global err
|
||||
|
||||
err = err + "%s %s" % (ctx, str)
|
||||
|
||||
libxml2.registerErrorHandler(callback, "-->")
|
||||
doc = libxml2.parseFile("missing.xml")
|
||||
if err != expect:
|
||||
print "error"
|
||||
print "received %s" %(err)
|
||||
print "expected %s" %(expect)
|
||||
sys.exit(1)
|
||||
|
||||
i = 10000
|
||||
while i > 0:
|
||||
doc = libxml2.parseFile("missing.xml")
|
||||
err = ""
|
||||
i = i - 1
|
||||
|
||||
print "OK"
|
Reference in New Issue
Block a user