[Checkins] SVN: zope.exceptions/branches/tseaver-no_2to3/src/zope/exceptions/tests/test_exceptionformatter.py Complete coverage for z.e.exceptionformatter.HTMLExceptionFormatter.
Tres Seaver
cvs-admin at zope.org
Fri Apr 6 19:36:54 UTC 2012
Log message for revision 125027:
Complete coverage for z.e.exceptionformatter.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:46 UTC (rev 125026)
+++ zope.exceptions/branches/tseaver-no_2to3/src/zope/exceptions/tests/test_exceptionformatter.py 2012-04-06 19:36:50 UTC (rev 125027)
@@ -140,6 +140,11 @@
supplement = DummySupplement(INFO)
self.assertEqual(fmt.formatSupplement(supplement, tb=None), [INFO])
+ def test_formatSupplementInfo(self):
+ INFO = 'Some days\nI wish I had stayed in bed.'
+ fmt = self._makeOne()
+ self.assertEqual(fmt.formatSupplementInfo(INFO), INFO)
+
def test_formatTracebackInfo(self):
fmt = self._makeOne()
self.assertEqual(fmt.formatTracebackInfo('XYZZY'),
@@ -401,7 +406,50 @@
self.assertEqual(fmt.getPrefix(),
'<p>Traceback (most recent call last):</p>\r\n<ul>')
+ def test_formatSupplementLine(self):
+ fmt = self._makeOne()
+ self.assertEqual(fmt.formatSupplementLine('XXX'), '<b>XXX</b>')
+ def test_formatSupplementLine_w_markup(self):
+ fmt = self._makeOne()
+ self.assertEqual(fmt.formatSupplementLine('XXX & YYY'),
+ '<b>XXX & YYY</b>')
+
+ def test_formatSupplementInfo_simple(self):
+ INFO = 'Some days\nI wonder.'
+ fmt = self._makeOne()
+ self.assertEqual(fmt.formatSupplementInfo(INFO),
+ 'Some days<br />\r\nI wonder.')
+
+ def test_formatSupplementInfo_w_markup(self):
+ INFO = 'Some days\nI wonder, <b>Why?</b>.'
+ fmt = self._makeOne()
+ self.assertEqual(fmt.formatSupplementInfo(INFO),
+ 'Some days<br />\r\nI wonder, '
+ '<b>Why?</b>.')
+
+ def test_formatTracebackInfo(self):
+ fmt = self._makeOne()
+ self.assertEqual(fmt.formatTracebackInfo('XXX & YYY\nZZZ'),
+ '__traceback_info__: XXX & YYY<br />\r\nZZZ')
+
+ def test_formatLine_simple(self):
+ fmt = self._makeOne(with_filenames=True)
+ tb = DummyTB()
+ tb.tb_frame = f = DummyFrame()
+ result = fmt.formatLine(tb)
+ self.assertEqual(result,
+ '<li> File "%s", line %d, in %s</li>'
+ % (f.f_code.co_filename,
+ tb.tb_lineno,
+ f.f_code.co_name,
+ ))
+
+ def test_formatLastLine(self):
+ fmt = self._makeOne()
+ self.assertEqual(fmt.formatLastLine('XXX'), '</ul><p>XXX</p>')
+
+
class Test_format_exception(unittest.TestCase):
def _callFUT(self, as_html=False):
More information about the checkins
mailing list