From f8cc464452f495fce2a3d6f7494396c8f798a1e6 Mon Sep 17 00:00:00 2001 From: Edward Henderson Date: Wed, 15 Apr 2015 16:28:49 -0600 Subject: Fixed #16501 -- Added an allow_unicode parameter to SlugField. Thanks Flavio Curella and Berker Peksag for the initial patch. --- tests/utils_tests/test_text.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'tests/utils_tests') diff --git a/tests/utils_tests/test_text.py b/tests/utils_tests/test_text.py index d8675fa8c5..e6f5c0f378 100644 --- a/tests/utils_tests/test_text.py +++ b/tests/utils_tests/test_text.py @@ -172,11 +172,16 @@ class TestUtilsText(SimpleTestCase): def test_slugify(self): items = ( - ('Hello, World!', 'hello-world'), - ('spam & eggs', 'spam-eggs'), + # given - expected - unicode? + ('Hello, World!', 'hello-world', False), + ('spam & eggs', 'spam-eggs', False), + ('spam & ıçüş', 'spam-ıçüş', True), + ('foo ıç bar', 'foo-ıç-bar', True), + (' foo ıç bar', 'foo-ıç-bar', True), + ('你好', '你好', True), ) - for value, output in items: - self.assertEqual(text.slugify(value), output) + for value, output, is_unicode in items: + self.assertEqual(text.slugify(value, allow_unicode=is_unicode), output) def test_unescape_entities(self): items = [ -- cgit v1.3