Пример #1
0
 def test_slugify(self):
     self.assertEqual(
         slugify(
             " Jack & Jill like numbers 1,2,3 and 4 and silly characters ?%.$!/"
         ),
         "Jack-Jill-like-numbers-123-and-4-and-silly-characters-",
     )
Пример #2
0
 def test_slugify_lazy_string(self):
     lazy_str = lazy(lambda string: string, str)
     self.assertEqual(
         slugify(
             lazy_str(
                 " Jack & Jill like numbers 1,2,3 and 4 and silly characters ?%.$!/"
             )),
         "Jack-Jill-like-numbers-123-and-4-and-silly-characters-",
     )
Пример #3
0
 def test_non_string_input(self):
     self.assertEqual(slugify(123), "123")
Пример #4
0
 def test_unicode(self):
     self.assertEqual(
         slugify("Un \xe9l\xe9phant \xe0 l'or\xe9e du bois"),
         "Un-elephant-a-loree-du-bois",
     )