changeset 61:6c0a8bd9aa9a

more xpath attribute tests (with other and without value)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 18 May 2010 14:58:05 +0200
parents 0c6020f1a2be
children 2461a04b352e
files emeraldtree/tests/test_tree.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/emeraldtree/tests/test_tree.py	Tue May 18 14:51:19 2010 +0200
+++ b/emeraldtree/tests/test_tree.py	Tue May 18 14:58:05 2010 +0200
@@ -218,11 +218,20 @@
     b2 = Element(u'b')
     a1 = Element(u'a', children=(b1, b2, ))
 
+    result = list(b1.findall(u"c[@testattr]"))
+    # note: does not work without c, like b1.findall(u"[@testattr]") - should it?
+    assert len(result) == 1
+    assert result[0] is c2
+
     result = list(b1.findall(u"c[@testattr='testvalue']"))
     # note: does not work without c, like b1.findall(u"[@testattr='testvalue']") - should it?
     assert len(result) == 1
     assert result[0] is c2
 
+    result = list(b1.findall(u"c[@testattr='othervalue']"))
+    # note: does not work without c, like b1.findall(u"[@testattr='othervalue']") - should it?
+    assert len(result) == 0
+
 def test_Element_findall_position():
     py.test.skip('not supported')
     c1 = Element(u'c')