1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

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

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