[Checkins] SVN: zope.exceptions/branches/tseaver-no_2to3/src/zope/exceptions/tests/test_exceptionformatter.py Begin coverage for HTMLExceptionFormatter.
Tres Seaver
cvs-admin at zope.org
Fri Apr 6 19:36:46 UTC 2012
Log message for revision 125025:
Begin coverage for HTMLExceptionFormatter.
Changed:
U zope.exceptions/branches/tseaver-no_2to3/src/zope/exceptions/tests/test_exceptionformatter.py
-=-
Modified: zope.exceptions/branches/tseaver-no_2to3/src/zope/exceptions/tests/test_exceptionformatter.py
===================================================================
--- zope.exceptions/branches/tseaver-no_2to3/src/zope/exceptions/tests/test_exceptionformatter.py 2012-04-06 19:36:38 UTC (rev 125024)
+++ zope.exceptions/branches/tseaver-no_2to3/src/zope/exceptions/tests/test_exceptionformatter.py 2012-04-06 19:36:42 UTC (rev 125025)
@@ -366,6 +366,42 @@
'in dummy_function\n')
+class HTMLExceptionFormatterTests(unittest.TestCase):
+
+ def _getTargetClass(self):
+ from zope.exceptions.exceptionformatter import HTMLExceptionFormatter
+ return HTMLExceptionFormatter
+
+ def _makeOne(self, *args, **kw):
+ return self._getTargetClass()(*args, **kw)
+
+ def test_ctor_defaults(self):
+ fmt = self._makeOne()
+ self.assertEqual(fmt.line_sep, '<br />\r\n')
+ self.assertEqual(fmt.limit, None)
+ self.assertEqual(fmt.with_filenames, False)
+
+ def test_ctor_explicit(self):
+ fmt = self._makeOne(limit=20, with_filenames=True)
+ self.assertEqual(fmt.line_sep, '<br />\r\n')
+ self.assertEqual(fmt.limit, 20)
+ self.assertEqual(fmt.with_filenames, True)
+
+ def test_escape_simple(self):
+ fmt = self._makeOne()
+ self.assertEqual(fmt.escape('XXX'), 'XXX')
+
+ def test_escape_w_markup(self):
+ fmt = self._makeOne()
+ self.assertEqual(fmt.escape('<span>XXX & YYY<span>'),
+ '<span>XXX & YYY<span>')
+
+ def test_getPrefix(self):
+ fmt = self._makeOne()
+ self.assertEqual(fmt.getPrefix(),
+ '<p>Traceback (most recent call last):\r\n<ul>')
+
+
class Test_format_exception(unittest.TestCase):
def _callFUT(self, as_html=False):
@@ -664,6 +700,7 @@
def test_suite():
return unittest.TestSuite((
+ unittest.makeSuite(TextExceptionFormatterTests),
unittest.makeSuite(Test_format_exception),
unittest.makeSuite(Test_extract_stack),
))
More information about the checkins
mailing list