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('