Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Jajcus/pyxmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJacek Konieczny <jajcus@jajcus.net>2006-01-01 22:28:05 +0300
committerJacek Konieczny <jajcus@jajcus.net>2006-01-01 22:28:05 +0300
commit3a44bfbc38f433c136fe74f4882f3e5ab1722222 (patch)
tree1e0f0a43bbe5398b22a71e77601dc8d8cccd8927 /tests
parent51140afd424f2830bb563760802c2c0ad0d750a0 (diff)
- compatibility fixes for older libxml2 (xmlNode.ns() fails there when node does not have namespace)
Diffstat (limited to 'tests')
-rwxr-xr-xtests/ns_operations.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/ns_operations.py b/tests/ns_operations.py
index 3b255a1..59d7e64 100755
--- a/tests/ns_operations.py
+++ b/tests/ns_operations.py
@@ -63,13 +63,19 @@ class TestReplaceNs(unittest.TestCase):
doc.setRootElement(root)
n = input_doc.getRootElement()
- input_ns = n.ns()
+ try:
+ input_ns = n.ns()
+ except libxml2.treeError:
+ input_ns = None
n = n.children
while n:
n1 = n.docCopyNode(doc, 1)
root.addChild(n1)
if n1.type == 'element':
- n1_ns = n1.ns()
+ try:
+ n1_ns = n1.ns()
+ except libxml2.treeError:
+ ns1_ns = None
if n1_ns.content == input_ns.content:
xmlextra.replace_ns(n1, n1_ns, common_ns)
n = n.next
@@ -84,7 +90,10 @@ class TestReplaceNs(unittest.TestCase):
doc.setRootElement(root)
n = input_doc2.getRootElement()
- input_ns = n.ns()
+ try:
+ input_ns = n.ns()
+ except libxml2.treeError:
+ input_ns = None
n = n.children
while n:
n1 = n.docCopyNode(doc, 1)
@@ -104,7 +113,11 @@ class TestReplaceNs(unittest.TestCase):
doc1 = libxml2.parseDoc(s1)
root1 = doc1.getRootElement()
el1 = root1.children
- el1.setNs(root1.ns())
+ try:
+ root1_ns = root1.ns()
+ except libxml2.treeError:
+ root1_ns = None
+ el1.setNs(root1_ns)
#s = el1.serialize()
s = xmlextra.safe_serialize(el1)