From 85082f6e5d3d5d4d53a1eaa856c5737875efd190 Mon Sep 17 00:00:00 2001 From: Arthur Darcet Date: Fri, 3 Jul 2015 15:57:50 +0200 Subject: unichr is not defined in python 3 --- slugify/slugify.py | 1 + 1 file changed, 1 insertion(+) diff --git a/slugify/slugify.py b/slugify/slugify.py index 5951eb3..4c134f3 100644 --- a/slugify/slugify.py +++ b/slugify/slugify.py @@ -11,6 +11,7 @@ except ImportError: from html.entities import name2codepoint _unicode = str _unicode_type = str + unichr = chr import unidecode -- cgit v1.2.1 From 706ecc0d30217c2dd125def1cc5cb5445b010dfa Mon Sep 17 00:00:00 2001 From: Arthur Darcet Date: Fri, 3 Jul 2015 16:05:06 +0200 Subject: add a test --- test.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test.py b/test.py index 775a264..4d883d2 100644 --- a/test.py +++ b/test.py @@ -131,6 +131,11 @@ class TestSlugification(unittest.TestCase): r = slugify(txt, stopwords=['the', 'in', 'a', 'hurry']) self.assertEqual(r, 'quick-brown-fox-jumps-over-lazy-dog') + def test_html_entities(self): + txt = 'foo & bar' + r = slugify(txt) + self.assertEqual(r, 'foo-bar') + if __name__ == '__main__': unittest.main() -- cgit v1.2.1