1#!/usr/bin/python -u 2# 3import libxml2 4 5expect=' xmlns:a="urn:whatevar"' 6 7# Memory debug specific 8libxml2.debugMemory(1) 9 10d = libxml2.parseDoc("<a:a xmlns:a='urn:whatevar'/>") 11res="" 12for n in d.xpathEval("//namespace::*"): 13 res = res + n.serialize() 14d.freeDoc() 15 16if res != expect: 17 print("test5 failed: unexpected output") 18 print(res) 19del res 20del d 21del n 22# Memory debug specific 23libxml2.cleanupParser() 24 25if libxml2.debugMemory(1) == 0: 26 print("OK") 27else: 28 print("Memory leak %d bytes" % (libxml2.debugMemory(1))) 29 libxml2.dumpMemory() 30