Initial revision
[TestXSLT.git] / libxml2 / python / tests / outbuf.py
1 #!/usr/bin/python -u
2 import sys
3 import libxml2
4 import StringIO
5
6 print "Skipped"
7 sys.exit(1)
8
9 # Memory debug specific
10 libxml2.debugMemory(1)
11
12 #f = open('res', 'w')
13 f = StringIO.StringIO()
14 buf = libxml2.createOutputBuffer(f, "ISO-8859-1")
15 buf.write(3, "foo")
16 buf.writeString("bar")
17 buf.close()
18 del buf
19
20 if f.getvalue() != "foobar":
21     print "Failed to save to StringIO"
22     sys.exit(1)
23
24 del f
25
26 # Memory debug specific
27 libxml2.cleanupParser()
28 if libxml2.debugMemory(1) == 0:
29     print "OK"
30 else:
31     print "Memory leak %d bytes" % (libxml2.debugMemory(1))
32     libxml2.dumpMemory()
33