summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_text.py
diff options
context:
space:
mode:
authorJaap Roes <jaap@eight.nl>2013-07-18 10:45:34 +0200
committerTim Graham <timograham@gmail.com>2013-10-08 08:24:58 -0400
commit40b95a24ae159b6600457a23d6c2779a18037b7b (patch)
treeb87eeb863c18b32f524ee437d2b364c982199d19 /tests/utils_tests/test_text.py
parent58d555caf527d6f1bdfeab14527484e4cca68648 (diff)
Fixed #20568 -- truncatewords_html no longer splits words containing HTML entities.
Thanks yann0 at hotmail.com for the report.
Diffstat (limited to 'tests/utils_tests/test_text.py')
-rw-r--r--tests/utils_tests/test_text.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/utils_tests/test_text.py b/tests/utils_tests/test_text.py
index dd72d26e06..62f1333517 100644
--- a/tests/utils_tests/test_text.py
+++ b/tests/utils_tests/test_text.py
@@ -82,6 +82,15 @@ class TestUtilsText(SimpleTestCase):
self.assertEqual('<br>The <hr/>quick <em>brown...</em>',
truncator.words(3, '...', html=True ))
+ # Test html entities
+ truncator = text.Truncator('<i>Buenos d&iacute;as!'
+ ' &#x00bf;C&oacute;mo est&aacute;?</i>')
+ self.assertEqual('<i>Buenos d&iacute;as! &#x00bf;C&oacute;mo...</i>',
+ truncator.words(3, '...', html=True))
+ truncator = text.Truncator('<p>I &lt;3 python, what about you?</p>')
+ self.assertEqual('<p>I &lt;3 python...</p>',
+ truncator.words(3, '...', html=True))
+
def test_wrap(self):
digits = '1234 67 9'
self.assertEqual(text.wrap(digits, 100), '1234 67 9')