Fixed #21572 -- Added unit test for django.utils.text.normalize_newlines.

This commit is contained in:
Vajrasky Kok 2013-12-07 16:28:22 +08:00
parent 19b22d4f0e
commit a1a26690b9
1 changed files with 7 additions and 0 deletions

View File

@ -107,6 +107,13 @@ class TestUtilsText(SimpleTestCase):
self.assertEqual(text.wrap('a %s word' % long_word, 10),
'a\n%s\nword' % long_word)
def test_normalize_newlines(self):
self.assertEqual(text.normalize_newlines("abc\ndef\rghi\r\n"),
"abc\ndef\nghi\n")
self.assertEqual(text.normalize_newlines("\n\r\r\n\r"), "\n\n\n\n")
self.assertEqual(text.normalize_newlines("abcdefghi"), "abcdefghi")
self.assertEqual(text.normalize_newlines(""), "")
def test_slugify(self):
items = (
('Hello, World!', 'hello-world'),