Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #1885 -- always return unicode in slugify
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
- Loading branch information
Showing
3 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# -*- coding: utf-8 -*- | ||
import nikola.utils | ||
|
||
def test_ascii(): | ||
o = nikola.utils.slugify(u'abcdef') | ||
assert o == u'abcdef' | ||
assert isinstance(o, nikola.utils.unicode_str) | ||
|
||
def test_ascii_dash(): | ||
o = nikola.utils.slugify(u'abc-def') | ||
assert o == u'abc-def' | ||
assert isinstance(o, nikola.utils.unicode_str) | ||
|
||
def test_pl(): | ||
o = nikola.utils.slugify(u'ąbćdef') | ||
assert o == u'abcdef' | ||
assert isinstance(o, nikola.utils.unicode_str) | ||
|
||
def test_pl_dash(): | ||
o = nikola.utils.slugify(u'ąbć-def') | ||
assert o == u'abc-def' | ||
assert isinstance(o, nikola.utils.unicode_str) | ||
|
||
def test_disarmed(): | ||
nikola.utils.USE_SLUGIFY = False | ||
o = nikola.utils.slugify(u'ąbć-def') | ||
assert o == u'ąbć-def' | ||
assert isinstance(o, nikola.utils.unicode_str) | ||
nikola.utils.USE_SLUGIFY = True | ||
|
||
def test_disarmed_weird(): | ||
nikola.utils.USE_SLUGIFY = False | ||
o = nikola.utils.slugify(u'ąbć-def "Hello World"?#H<e>l/l\\o:W\'o\rr*l\td|!\n') | ||
assert o == u'ąbć-def -Hello World---H-e-l-l-o-W-o-r-l-d-!-' | ||
assert isinstance(o, nikola.utils.unicode_str) | ||
nikola.utils.USE_SLUGIFY = True |