~ubuntu-branches/ubuntu/wily/libxml2/wily-proposed

« back to all changes in this revision

Viewing changes to python/tests/tstxpath.py

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2013-07-11 09:31:50 UTC
  • mfrom: (43.2.4 sid)
  • Revision ID: package-import@ubuntu.com-20130711093150-t3vcnrpfqepqt0mp
Tags: 2.9.1+dfsg1-2ubuntu1
* Merged from Debian unstable. Remaining changes:
  - Fix python multi-arch includes issues. 
  - Allow the package to cross-build.
  - Set PYTHON_LIBS for cross builds.
  - Remove explicit build dependency on binutils.
  - Configure the udeb --without-python.
* Dropped patches:
  - CVE-2013-0338.patch: upstream
  - CVE-2013-1969.patch: upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
ctxt = doc.xpathNewContext()
26
26
res = ctxt.xpathEval("//*")
27
27
if len(res) != 2:
28
 
    print "xpath query: wrong node set size"
 
28
    print("xpath query: wrong node set size")
29
29
    sys.exit(1)
30
30
if res[0].name != "doc" or res[1].name != "foo":
31
 
    print "xpath query: wrong node set value"
 
31
    print("xpath query: wrong node set value")
32
32
    sys.exit(1)
33
33
libxml2.registerXPathFunction(ctxt._o, "foo", None, foo)
34
34
libxml2.registerXPathFunction(ctxt._o, "bar", None, bar)
36
36
while i > 0:
37
37
    res = ctxt.xpathEval("foo(1)")
38
38
    if res != 2:
39
 
        print "xpath extension failure"
 
39
        print("xpath extension failure")
40
40
        sys.exit(1)
41
41
    i = i - 1
42
42
i = 10000
43
43
while i > 0:
44
44
    res = ctxt.xpathEval("bar(1)")
45
45
    if res != "3":
46
 
        print "xpath extension failure got %s expecting '3'"
 
46
        print("xpath extension failure got %s expecting '3'")
47
47
        sys.exit(1)
48
48
    i = i - 1
49
49
doc.freeDoc()
50
50
ctxt.xpathFreeContext()
51
51
 
52
52
if called != "foo":
53
 
    print "xpath function: failed to access the context"
54
 
    print "xpath function: %s" % (called)
 
53
    print("xpath function: failed to access the context")
 
54
    print("xpath function: %s" % (called))
55
55
    sys.exit(1)
56
56
 
57
57
#memory debug specific
58
58
libxml2.cleanupParser()
59
59
if libxml2.debugMemory(1) == 0:
60
 
    print "OK"
 
60
    print("OK")
61
61
else:
62
 
    print "Memory leak %d bytes" % (libxml2.debugMemory(1))
 
62
    print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
63
63
    libxml2.dumpMemory()