changeset 57:c1feee84d5d8

add tests for findtext()
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 18 May 2010 13:20:51 +0200
parents 644bf7185b57
children 9d0db78957e0
files emeraldtree/tests/test_tree.py
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/emeraldtree/tests/test_tree.py	Tue Oct 27 15:47:37 2009 +0100
+++ b/emeraldtree/tests/test_tree.py	Tue May 18 13:20:51 2010 +0200
@@ -102,8 +102,18 @@
     result = elem.find(u'{url1}b1')
     assert result is child_1
 
+def test_Element_findtext_default():
+    elem = Element(u'a')
+    default_text = u'defaulttext'
+    result = elem.findtext(u'b', default=default_text)
+    assert result is default_text
+
 def test_Element_findtext():
-    pass
+    child_text = u"text"
+    child = Element(u'b', children=(child_text, ))
+    elem = Element(u'a', children=(child, ))
+    result = elem.findtext(u'b')
+    assert result is child_text
 
 def test_Element_findall():
     child_1 = Element(u'b1')