summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-07-31 18:30:18 -0400
committerTim Graham <timograham@gmail.com>2017-08-02 15:07:26 -0400
commit74b7a20fe6973a53923059795cb538d094c925d8 (patch)
tree555644d9145ce040954573022c50e74bbd95cd75
parent78c155cf2e5a27fd2db18c2d46953b1b0fdba829 (diff)
Refs #5046 -- Tested the 'unicode hint' in the technical 500 debug view.
-rw-r--r--tests/view_tests/tests/test_debug.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py
index a89507269a..aa0a025eed 100644
--- a/tests/view_tests/tests/test_debug.py
+++ b/tests/view_tests/tests/test_debug.py
@@ -446,6 +446,18 @@ class ExceptionReporterTests(SimpleTestCase):
self.assertEqual(len(html) // 1024 // 128, 0) # still fit in 128Kb
self.assertIn('&lt;trimmed %d bytes string&gt;' % (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