diff emeraldtree/tests/test_tree.py @ 77:f7db63ba09f4

Tree - Add element only tree iterator
author Bastian Blank <bblank@thinkmo.de>
date Thu, 10 Jun 2010 14:55:32 +0200
parents 2175b8941596
children 9d39d4bc2deb
line wrap: on
line diff
--- a/emeraldtree/tests/test_tree.py	Thu Jun 10 14:39:36 2010 +0200
+++ b/emeraldtree/tests/test_tree.py	Thu Jun 10 14:55:32 2010 +0200
@@ -313,6 +313,19 @@
     elem.append(u'b')
     assert len(list(elem.iter_elements())) == 1
 
+def test_Element_iter_elements_tree():
+    elem = Element(u'a')
+    assert len(list(elem.iter_elements_tree())) == 1
+
+    elem.append(u'b')
+    assert len(list(elem.iter_elements_tree())) == 1
+
+    elem.append(Element(u'c'))
+    assert len(list(elem.iter_elements_tree())) == 2
+
+    elem.append(u'd')
+    assert len(list(elem.iter_elements_tree())) == 2
+
 def test_Comment():
     elem = Comment(u'a')
     assert serialize(elem) == u'<!--a-->'