diff -r 5ff1fc726848 -r c6bca38c1cbf parts/django/tests/regressiontests/utils/text.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/parts/django/tests/regressiontests/utils/text.py Sat Jan 08 11:20:57 2011 +0530 @@ -0,0 +1,20 @@ +import unittest + +from django.utils import text + +class TestUtilsText(unittest.TestCase): + def test_truncate_words(self): + self.assertEqual(u'The quick brown fox jumped over the lazy dog.', + text.truncate_words(u'The quick brown fox jumped over the lazy dog.', 10)) + self.assertEqual(u'The quick brown fox ...', + text.truncate_words('The quick brown fox jumped over the lazy dog.', 4)) + self.assertEqual(u'The quick brown fox ....', + text.truncate_words('The quick brown fox jumped over the lazy dog.', 4, '....')) + self.assertEqual(u'

The quick brown fox jumped over the lazy dog.

', + text.truncate_html_words('

The quick brown fox jumped over the lazy dog.

', 10)) + self.assertEqual(u'

The quick brown fox ...

', + text.truncate_html_words('

The quick brown fox jumped over the lazy dog.

', 4)) + self.assertEqual(u'

The quick brown fox ....

', + text.truncate_html_words('

The quick brown fox jumped over the lazy dog.

', 4, '....')) + self.assertEqual(u'

The quick brown fox

', + text.truncate_html_words('

The quick brown fox jumped over the lazy dog.

', 4, None))