def test_xmlschema_illegal_validation_error(self): schema = self.parse(''' <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="a" type="xsd:string"/> </xsd:schema> ''') schema = etree.XMLSchema(schema) root = etree.Element('a') root.text = 'TEST' self.assertTrue(schema(root)) self.assertRaises(ValueError, schema, etree.Comment('TEST')) self.assertRaises(ValueError, schema, etree.PI('a', 'text')) self.assertRaises(ValueError, schema, etree.Entity('text'))
def test_unicode_comment(self): el = etree.Comment(uni) self.assertEquals(uni, el.text)
def test_unicode_repr2(self): x = etree.Comment(_str('ö')) repr(x)
def test_comment(self): with etree.xmlfile(self._file) as xf: xf.write(etree.Comment('a comment')) with xf.element('test'): pass self.assertXml('<!--a comment--><test></test>')
def test_xmlschema_comment_error(self): self.assertRaises(ValueError, etree.XMLSchema, etree.Comment('TEST'))