diff emeraldtree/tests/test_tree.py @ 76:2175b8941596

Tree - Add element only iterator
author Bastian Blank <bblank@thinkmo.de>
date Thu, 10 Jun 2010 14:39:36 +0200
parents 47b1c1aa1a2b
children f7db63ba09f4
line wrap: on
line diff
--- a/emeraldtree/tests/test_tree.py	Tue Jun 08 22:28:35 2010 +0200
+++ b/emeraldtree/tests/test_tree.py	Thu Jun 10 14:39:36 2010 +0200
@@ -303,6 +303,16 @@
     l = list(elem.itertext())
     assert len(l) == 1
 
+def test_Element_iter_elements():
+    elem = Element(u'a')
+    assert len(list(elem.iter_elements())) == 0
+
+    elem.append(Element(u'c'))
+    assert len(list(elem.iter_elements())) == 1
+
+    elem.append(u'b')
+    assert len(list(elem.iter_elements())) == 1
+
 def test_Comment():
     elem = Comment(u'a')
     assert serialize(elem) == u'<!--a-->'