コード例 #1
0
 def test_long_slug_string(self):
     long_string = (
         "This string is more than 100 characters long, I assure you. "
         "No, really, more than 100 characters loooong.")
     self.assertEqual(generate_short_slug(long_string),
                      ('this-string-is-more-than-100-characters-long-'
                       'i-assure-you-no-really-more-than-100-characters'))
コード例 #2
0
 def test_long_slug_string(self):
     long_string = (
         "This string is more than 100 characters long, I assure you. "
         "No, really, more than 100 characters loooong.")
     self.assertEqual(
         generate_short_slug(long_string),
         ('this-string-is-more-than-100-characters-long-'
          'i-assure-you-no-really-more-than-100-characters'))
コード例 #3
0
 def test_slug_string_that_will_end_with_a_hyphen(self):
     """
     It's possible for slug truncation to result in a slug that ends
     on a hypthen. In that case the function should strip the ending hyphen.
     """
     will_end_with_hyphen = (
         "This string is more than 100 characters long, I assure you. "
         "No, really, more than 100 characters looong and end on a hyphen.")
     self.assertEqual(
         generate_short_slug(will_end_with_hyphen),
         'this-string-is-more-than-100-characters-long-i-assure-you-'
         'no-really-more-than-100-characters-looong')
コード例 #4
0
 def test_slug_string_that_will_end_with_a_hyphen(self):
     """
     It's possible for slug truncation to result in a slug that ends
     on a hypthen. In that case the function should strip the ending hyphen.
     """
     will_end_with_hyphen = (
         "This string is more than 100 characters long, I assure you. "
         "No, really, more than 100 characters looong and end on a hyphen.")
     self.assertEqual(
         generate_short_slug(will_end_with_hyphen),
         'this-string-is-more-than-100-characters-long-i-assure-you-'
         'no-really-more-than-100-characters-looong')
コード例 #5
0
 def test_short_slug_string(self):
     short_string = "This string is less than 100 characters long."
     self.assertEqual(generate_short_slug(short_string),
                      slugify(short_string))
コード例 #6
0
 def test_short_slug_string(self):
     short_string = "This string is less than 100 characters long."
     self.assertEqual(
         generate_short_slug(short_string), slugify(short_string))