def test_html(self): class IWithText(Interface): text = XMLText(title=u"Text") class Context(PortalContent): implements(IWithText) text = None widget = FieldWidget(IWithText['text'], XMLTextWidget(self.request)) widget.update() value = widget.extract() self.assertEquals(NOVALUE, value) self.request.form['%s' % widget.name] = u"<html><body>test</body></html>" self.request.form['%s.mimeType' % widget.name] = 'text/xml' widget.update() self.assertEquals(widget.html(), '<pre><html>\n <body>test</body>\n</html>\n</pre>')