mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Reorganized utils tests so it's all in separate modules. Thanks to Stephan Jaekel.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13889 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
20
tests/regressiontests/utils/text.py
Normal file
20
tests/regressiontests/utils/text.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from django.test import TestCase
|
||||
|
||||
from django.utils import text
|
||||
|
||||
class TestUtilsText(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'<p><strong><em>The quick brown fox jumped over the lazy dog.</em></strong></p>',
|
||||
text.truncate_html_words('<p><strong><em>The quick brown fox jumped over the lazy dog.</em></strong></p>', 10))
|
||||
self.assertEqual(u'<p><strong><em>The quick brown fox ...</em></strong></p>',
|
||||
text.truncate_html_words('<p><strong><em>The quick brown fox jumped over the lazy dog.</em></strong></p>', 4))
|
||||
self.assertEqual(u'<p><strong><em>The quick brown fox ....</em></strong></p>',
|
||||
text.truncate_html_words('<p><strong><em>The quick brown fox jumped over the lazy dog.</em></strong></p>', 4, '....'))
|
||||
self.assertEqual(u'<p><strong><em>The quick brown fox</em></strong></p>',
|
||||
text.truncate_html_words('<p><strong><em>The quick brown fox jumped over the lazy dog.</em></strong></p>', 4, None))
|
||||
Reference in New Issue
Block a user