Merge pull request #2045 from vajrasky/ticket_21572

Fixed #21572 -- Added unit test for django.utils.text.normalize_newlines...
This commit is contained in:
Claude Paroz 2013-12-07 01:07:23 -08:00
commit 6d20a80d98
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), self.assertEqual(text.wrap('a %s word' % long_word, 10),
'a\n%s\nword' % long_word) '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): def test_slugify(self):
items = ( items = (
('Hello, World!', 'hello-world'), ('Hello, World!', 'hello-world'),