[Lxml-checkins] r32376 - in lxml/branch/lxml-1.1/src/lxml: . tests
scoder at codespeak.net
scoder at codespeak.net
Fri Sep 15 19:44:42 CEST 2006
Author: scoder
Date: Fri Sep 15 19:44:40 2006
New Revision: 32376
Modified:
lxml/branch/lxml-1.1/src/lxml/objectify.pyx
lxml/branch/lxml-1.1/src/lxml/tests/test_objectify.py
Log:
testcase and fix for OE.countchildren()
Modified: lxml/branch/lxml-1.1/src/lxml/objectify.pyx
==============================================================================
--- lxml/branch/lxml-1.1/src/lxml/objectify.pyx (original)
+++ lxml/branch/lxml-1.1/src/lxml/objectify.pyx Fri Sep 15 19:44:40 2006
@@ -190,11 +190,11 @@
"""
# copied from etree
cdef Py_ssize_t c
- cdef xmlNode* c_node
+ cdef tree.xmlNode* c_node
c = 0
c_node = self._c_node.children
while c_node is not NULL:
- if _isElement(c_node):
+ if tree._isElement(c_node):
c = c + 1
c_node = c_node.next
return c
Modified: lxml/branch/lxml-1.1/src/lxml/tests/test_objectify.py
==============================================================================
--- lxml/branch/lxml-1.1/src/lxml/tests/test_objectify.py (original)
+++ lxml/branch/lxml-1.1/src/lxml/tests/test_objectify.py Fri Sep 15 19:44:40 2006
@@ -61,6 +61,11 @@
root = self.XML(xml_str)
self.assertEquals("0", root.c1.c2.text)
+ def test_countchildren(self):
+ root = self.XML(xml_str)
+ self.assertEquals(1, root.countchildren())
+ self.assertEquals(5, root.c1.countchildren())
+
def test_child_getattr(self):
root = self.XML(xml_str)
self.assertEquals("0", getattr(root.c1, "{objectified}c2").text)
More information about the lxml-checkins
mailing list