[Lxml-checkins] r32375 - in lxml/trunk/src/lxml: . tests

scoder at codespeak.net scoder at codespeak.net
Fri Sep 15 19:44:14 CEST 2006


Author: scoder
Date: Fri Sep 15 19:44:12 2006
New Revision: 32375

Modified:
   lxml/trunk/src/lxml/objectify.pyx
   lxml/trunk/src/lxml/tests/test_objectify.py
Log:
testcase and fix for OE.countchildren()

Modified: lxml/trunk/src/lxml/objectify.pyx
==============================================================================
--- lxml/trunk/src/lxml/objectify.pyx	(original)
+++ lxml/trunk/src/lxml/objectify.pyx	Fri Sep 15 19:44:12 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/trunk/src/lxml/tests/test_objectify.py
==============================================================================
--- lxml/trunk/src/lxml/tests/test_objectify.py	(original)
+++ lxml/trunk/src/lxml/tests/test_objectify.py	Fri Sep 15 19:44:12 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