[Lxml-checkins] r41644 - lxml/trunk/src/lxml/tests

scoder at codespeak.net scoder at codespeak.net
Thu Mar 29 21:40:45 CEST 2007


Author: scoder
Date: Thu Mar 29 21:40:38 2007
New Revision: 41644

Modified:
   lxml/trunk/src/lxml/tests/test_etree.py
Log:
raise AssertionError when string with '\0' bytes are passed into the API

Modified: lxml/trunk/src/lxml/tests/test_etree.py
==============================================================================
--- lxml/trunk/src/lxml/tests/test_etree.py	(original)
+++ lxml/trunk/src/lxml/tests/test_etree.py	Thu Mar 29 21:40:38 2007
@@ -1205,6 +1205,15 @@
         self.assertEquals(docinfo.root_name,   'html')
         self.assertEquals(docinfo.doctype, '')
 
+    def test_byte_zero(self):
+        Element = self.etree.Element
+
+        a = Element('a')
+        self.assertRaises(AssertionError, setattr, a, "text", 'ha\0ho')
+        self.assertRaises(AssertionError, setattr, a, "tail", 'ha\0ho')
+
+        self.assertRaises(AssertionError, Element, 'ha\0ho')
+
     def test_encoding_tostring_utf16(self):
         # ElementTree fails to serialize this
         tostring = self.etree.tostring


More information about the lxml-checkins mailing list