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