Пример #1
0
    def test_slugify_max_length(self):
        obj = TestSlugifyFromFields.MyObject("this", "and that")
        sluggy = helpers.slugify_from_fields(obj, ("a", "b"), max_length=7)
        self.assertEqual("this-an", sluggy())

        sluggy = helpers.slugify_from_fields(obj, ("a", "b"), max_length=5)
        # slugify() will lop off the trailing '-'...
        self.assertEqual("this", sluggy())
Пример #2
0
 def test_slugify_simple(self):
     obj = TestSlugifyFromFields.MyObject("this", "and that")
     sluggy = helpers.slugify_from_fields(obj, ("a", "b"))
     self.assertEqual("this-and-that", sluggy())