mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
updated the python bindings, added code for easier File I/O, and the
* python/generator.py python/libxml.c python/libxml.py python/libxml2-python-api.xml python/libxml2class.txt python/libxml_wrap.h python/types.c: updated the python bindings, added code for easier File I/O, and the ability to define a resolver from Python fixing bug #91635 * python/tests/Makefile.am python/tests/inbuf.py python/tests/outbuf.py python/tests/pushSAXhtml.py python/tests/resolver.py python/tests/serialize.py: updated and augmented the set of Python tests. Daniel
This commit is contained in:
39
python/tests/resolver.py
Executable file
39
python/tests/resolver.py
Executable file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/python -u
|
||||
import sys
|
||||
import libxml2
|
||||
import StringIO
|
||||
|
||||
# Memory debug specific
|
||||
libxml2.debugMemory(1)
|
||||
|
||||
def myResolver(URL, ID, ctxt):
|
||||
return(StringIO.StringIO("<foo/>"))
|
||||
|
||||
libxml2.setEntityLoader(myResolver)
|
||||
|
||||
doc = libxml2.parseFile("doesnotexist.xml")
|
||||
root = doc.children
|
||||
if root.name != "foo":
|
||||
print "root element name error"
|
||||
sys.exit(1)
|
||||
doc.freeDoc()
|
||||
|
||||
i = 0
|
||||
while i < 5000:
|
||||
doc = libxml2.parseFile("doesnotexist.xml")
|
||||
root = doc.children
|
||||
if root.name != "foo":
|
||||
print "root element name error"
|
||||
sys.exit(1)
|
||||
doc.freeDoc()
|
||||
i = i + 1
|
||||
|
||||
|
||||
# Memory debug specific
|
||||
libxml2.cleanupParser()
|
||||
if libxml2.debugMemory(1) == 0:
|
||||
print "OK"
|
||||
else:
|
||||
print "Memory leak %d bytes" % (libxml2.debugMemory(1))
|
||||
libxml2.dumpMemory()
|
||||
|
Reference in New Issue
Block a user