diff options
author | Val Neekman <val@neekware.com> | 2015-04-11 22:03:34 -0400 |
---|---|---|
committer | Val Neekman <val@neekware.com> | 2015-04-11 22:03:34 -0400 |
commit | f90ecf1905c9d06f32e676a2dcaff311f82df868 (patch) | |
tree | adb49e182792a29fb3381425262beee8484c91ec /README.md | |
parent | f64f1a3e84a73d54def5f89130c07a7b0814424e (diff) | |
download | python-slugify-f90ecf1905c9d06f32e676a2dcaff311f82df868.tar.gz |
remove 2to3 depenancy, add save word order
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -89,6 +89,30 @@ How to use txt = 'jaja---lol-méméméoo--a' r = slugify(txt, max_length=20, word_boundary=True, separator="ZZZZZZ") self.assertEqual(r, "jajaZZZZZZlolZZZZZZmememeooZZZZZZa") + + txt = "___This is a test ---" + r = slugify(txt) + self.assertEqual(r, "this-is-a-test") + + txt = "___This is a test___" + r = slugify(txt) + self.assertEqual(r, "this-is-a-test") + + txt = 'one two three four five' + r = slugify(txt, max_length=13, word_boundary=True, save_order=True) + self.assertEqual(r, "one-two-three") + + txt = 'one two three four five' + r = slugify(txt, max_length=13, word_boundary=True, save_order=False) + self.assertEqual(r, "one-two-three") + + txt = 'one two three four five' + r = slugify(txt, max_length=12, word_boundary=True, save_order=False) + self.assertEqual(r, "one-two-four") + + txt = 'one two three four five' + r = slugify(txt, max_length=12, word_boundary=True, save_order=True) + self.assertEqual(r, "one-two") ``` Running the tests |