changeset 49:78ef2b77ca4a

Tests for ElementTree - Fix tests for default namespace, fix types
author Bastian Blank <bblank@thinkmo.de>
date Tue, 12 Aug 2008 13:11:06 +0200
parents 547347034e65
children d3767204a325
files emeraldtree/tests/test_ElementTree.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/emeraldtree/tests/test_ElementTree.py	Tue Aug 12 13:10:33 2008 +0200
+++ b/emeraldtree/tests/test_ElementTree.py	Tue Aug 12 13:11:06 2008 +0200
@@ -15,9 +15,9 @@
     assert elem.tag == 'a'
 
 def test_Element__len__():
-    elem = Element('a', children = range(10))
+    elem = Element('a', children=['1', '2', '3', '4', '5'])
 
-    assert len(elem) == 10
+    assert len(elem) == 5
 
 def test_Element__nonzero__():
     elem = Element('a')
@@ -109,7 +109,7 @@
 def test_Element_findall():
     child_1 = Element('b1')
     child_2 = Element('b2')
-    child_3 = "text"
+    child_3 = u"text"
     elem = Element('a', children=[child_1, child_2, child_3])
 
     result = list(elem.findall('b1'))
@@ -261,13 +261,13 @@
     assert elem.tag == QName('b', 'c')
     assert elem.attrib == {QName('d', None): 'e'}
     assert serialize(elem) == '<ns0:b d="e" xmlns:ns0="c" />'
-    assert serialize(elem, default_namespace='c') == '<ns0:b d="e" xmlns:ns0="c" />'
+    assert serialize(elem, default_namespace='c') == '<b d="e" xmlns="c" />'
 
     elem = XML('<a:b xmlns:a="c" d="e" a:f="g"/>')
     assert isinstance(elem.tag, QName)
     assert elem.tag == QName('b', 'c')
     assert elem.attrib == {'d': 'e', QName('f', 'c'): 'g'}
     assert serialize(elem) == '<ns0:b d="e" ns0:f="g" xmlns:ns0="c" />'
-    assert serialize(elem, default_namespace='c') == '<ns0:b d="e" ns0:f="g" xmlns:ns0="c" />'
+    assert serialize(elem, default_namespace='c') == '<b d="e" f="g" xmlns="c" />'