[Lxml-checkins] r35616 - lxml/branch/nscleanup/src/lxml/tests
scoder at codespeak.net
scoder at codespeak.net
Tue Dec 12 10:44:56 CET 2006
Author: scoder
Date: Tue Dec 12 10:44:53 2006
New Revision: 35616
Modified:
lxml/branch/nscleanup/src/lxml/tests/test_etree.py
Log:
cleanup, new test case for namespace serialisation (fails)
Modified: lxml/branch/nscleanup/src/lxml/tests/test_etree.py
==============================================================================
--- lxml/branch/nscleanup/src/lxml/tests/test_etree.py (original)
+++ lxml/branch/nscleanup/src/lxml/tests/test_etree.py Tue Dec 12 10:44:53 2006
@@ -907,16 +907,13 @@
e1.prefix)
self.assertEquals(
None,
- e2.prefix)
+ e1[0].prefix)
self.assertEquals(
'{http://ns.infrae.com/foo}bar',
e1.tag)
self.assertEquals(
'{http://ns.infrae.com/foo}bar',
- e2.tag)
-
- print etree.tostring(e1)
- print etree.tostring(e2)
+ e1[0].tag)
def test_namespaces_copy_element(self):
etree = self.etree
@@ -940,13 +937,7 @@
'{http://ns.infrae.com/foo}bar',
e2.tag)
- print etree.tostring(e1)
- print etree.tostring(e2)
-
def test_namespaces_reuse_after_move(self):
- Element = self.etree.Element
- ElementTree = self.etree.ElementTree
-
ns_href = "http://a.b.c"
one = self.etree.parse(
StringIO('<foo><bar xmlns:ns="%s"><ns:baz/></bar></foo>' % ns_href))
@@ -962,6 +953,20 @@
'<root xmlns:ns="%s"><ns:baz/></root>' % ns_href,
self.etree.tostring(two))
+ def test_namespaces_after_serialize(self):
+ parse = self.etree.parse
+ tostring = self.etree.tostring
+
+ ns_href = "http://a.b.c"
+ one = parse(
+ StringIO('<foo><bar xmlns:ns="%s"><ns:baz/></bar></foo>' % ns_href))
+ baz = one.getroot()[0][0]
+
+ print tostring(baz)
+ parsed = parse(StringIO( tostring(baz) )).getroot()
+
+ self.assertEquals('{%s}baz' % ns_href, parsed.tag)
+
def test_element_nsmap(self):
etree = self.etree
More information about the lxml-checkins
mailing list