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