diff options
| author | Tim Graham <timograham@gmail.com> | 2017-07-31 18:30:18 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-08-02 15:07:26 -0400 |
| commit | 74b7a20fe6973a53923059795cb538d094c925d8 (patch) | |
| tree | 555644d9145ce040954573022c50e74bbd95cd75 | |
| parent | 78c155cf2e5a27fd2db18c2d46953b1b0fdba829 (diff) | |
Refs #5046 -- Tested the 'unicode hint' in the technical 500 debug view.
| -rw-r--r-- | tests/view_tests/tests/test_debug.py | 12 |
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('<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 |
