diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2002-02-03 16:53:19 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2002-02-03 16:53:19 +0000 |
commit | 26f1dcc5bda9fbd0711bd93f72ed20d4eaec3cbf (patch) | |
tree | 6fba6d67a5e6c9193a9df3f8dd5004a44eb177ec /python/tests/error.py | |
parent | 3ce5257b293ed75d8feb18ed7ab18ea2b52510bd (diff) | |
download | libxml2-26f1dcc5bda9fbd0711bd93f72ed20d4eaec3cbf.tar.gz |
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
Diffstat (limited to 'python/tests/error.py')
-rwxr-xr-x | python/tests/error.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/python/tests/error.py b/python/tests/error.py new file mode 100755 index 00000000..21cf5589 --- /dev/null +++ b/python/tests/error.py @@ -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" |