1.1 --- a/tests/macrotest.py Mon Jan 24 10:36:41 2005 +0000
1.2 +++ b/tests/macrotest.py Mon Jan 24 10:37:17 2005 +0000
1.3 @@ -2,8 +2,7 @@
1.4
1.5 "A test of macros."
1.6
1.7 -from libxml2dom.macrolib import *
1.8 -import libxml2
1.9 +import libxml2macro as x2_
1.10 import xml.dom
1.11
1.12 class Container:
1.13 @@ -82,18 +81,23 @@
1.14
1.15 def test_import(x2_d):
1.16
1.17 - x2_root = find_root(x2_d)
1.18 + # Change the prefix.
1.19 +
1.20 + import libxml2macro as node_
1.21 + node_d = x2_d
1.22 +
1.23 + node_root = find_root(node_d)
1.24
1.25 # Create a new document.
1.26
1.27 - x2_d2 = createDocument("nsD", "newdoc", None)
1.28 - x2_root2 = find_root(x2_d2)
1.29 + node_d2 = createDocument("nsD", "newdoc", None)
1.30 + node_root2 = find_root(node_d2)
1.31
1.32 # Attempt to import nodes from the original document.
1.33
1.34 - x2_imported = x2_d2.importNode(x2_root, 1)
1.35 - x2_d2.replaceChild(x2_imported, x2_root2)
1.36 + node_imported = node_d2.importNode(node_root, 1)
1.37 + node_d2.replaceChild(node_imported, node_root2)
1.38
1.39 - return x2_d, x2_d2
1.40 + return node_d, node_d2
1.41
1.42 # vim: tabstop=4 expandtab shiftwidth=4
2.1 --- a/tests/performance.py Mon Jan 24 10:36:41 2005 +0000
2.2 +++ b/tests/performance.py Mon Jan 24 10:37:17 2005 +0000
2.3 @@ -36,7 +36,7 @@
2.4
2.5 t = time.time()
2.6 x2_d1, x2_d2 = macrotest.test_import(x2_d)
2.7 - macrotest.toFile(x2_d, "/tmp/xxx_macrotest.xml")
2.8 + macrotest.toFile(x2_d2, "/tmp/xxx_macrotest.xml")
2.9 print "Time", time.time() - t, "seconds"
2.10
2.11 elif sys.argv[2] == "minidom":
2.12 @@ -45,7 +45,7 @@
2.13
2.14 t = time.time()
2.15 d1, d2 = test_import(d)
2.16 - open("/tmp/xxx_minidom.xml", "wb").write(d1.toxml("utf-8"))
2.17 + open("/tmp/xxx_minidom.xml", "wb").write(d2.toxml("utf-8"))
2.18 print "Time", time.time() - t, "seconds"
2.19
2.20 elif sys.argv[2] == "libxml2dom":
2.21 @@ -54,7 +54,7 @@
2.22
2.23 t = time.time()
2.24 d1, d2 = test_import2(d)
2.25 - libxml2dom.toStream(d1, open("/tmp/xxx_libxml2dom.xml", "wb"))
2.26 + libxml2dom.toStream(d2, open("/tmp/xxx_libxml2dom.xml", "wb"))
2.27 print "Time", time.time() - t, "seconds"
2.28
2.29 # vim: tabstop=4 expandtab shiftwidth=4