Refs #5046 -- Tested the 'unicode hint' in the technical 500 debug view.

This commit is contained in:
Tim Graham 2017-07-31 18:30:18 -04:00
parent 78c155cf2e
commit 74b7a20fe6
1 changed files with 12 additions and 0 deletions

View File

@ -446,6 +446,18 @@ class ExceptionReporterTests(SimpleTestCase):
self.assertEqual(len(html) // 1024 // 128, 0) # still fit in 128Kb
self.assertIn('<trimmed %d bytes string>' % (large + repr_of_str_adds,), html)
def test_encoding_error(self):
"""A UnicodeError displays a portion of the problematic string."""
try:
'abcdefghijklmnὀpqrstuwxyz'.encode('ascii')
except Exception:
exc_type, exc_value, tb = sys.exc_info()
reporter = ExceptionReporter(None, exc_type, exc_value, tb)
html = reporter.get_traceback_html()
self.assertIn('<h2>Unicode error hint</h2>', html)
self.assertIn('The string that could not be encoded/decoded was: ', html)
self.assertIn('<strong>jklmnὀpqrst</strong>', html)
def test_unfrozen_importlib(self):
"""
importlib is not a frozen app, but its loader thinks it's frozen which