mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #16501 -- Added an allow_unicode parameter to SlugField.
Thanks Flavio Curella and Berker Peksag for the initial patch.
This commit is contained in:
parent
adffff79a3
commit
f8cc464452
26 changed files with 223 additions and 46 deletions
|
@ -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 = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue