def test_str(self): self.assertEqual(html_filter('foo'), u'foo') self.assertEqual(html_filter('foo &<>\'" bar'), u'foo &<>'" bar') self.assertEqual(html_filter('\xe2\x80\x99'), u'\u2019') self.assertRaises(UnicodeError, html_filter, '\xff')
def test_non_string(self): self.assertEqual(html_filter(1234), u'1234') self.assertEqual(html_filter(['<']), u'['<']')
def test_none(self): self.assertEqual(html_filter(None), u'')
def test_unicode(self): self.assertEqual(html_filter(u'\u2019'), u'\u2019') self.assertEqual(html_filter(u'<\u2019>'), u'<\u2019>') self.assertEqual(html_filter(u'foo &<>\'" bar'), u'foo &<>'" bar')