diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-06-12 11:42:22 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-06-12 11:42:22 +0000 |
commit | 02cd9b5f44faed64528c6fbe4c06f734a4c11208 (patch) | |
tree | 12fcbe3e0822da1fbd11f309cd929a2c6bf85eac /tests | |
parent | da554770974706ffa6f69f12d9051062cd0d0b80 (diff) | |
parent | 472d8ed162ffc0b1083b761627a8ed86e7d71ae7 (diff) | |
download | oslo-02cd9b5f44faed64528c6fbe4c06f734a4c11208.tar.gz oslo-02cd9b5f44faed64528c6fbe4c06f734a4c11208.tar.xz oslo-02cd9b5f44faed64528c6fbe4c06f734a4c11208.zip |
Merge "Add slugify to strutils"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/test_strutils.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/unit/test_strutils.py b/tests/unit/test_strutils.py index 42160a6..a8d8462 100644 --- a/tests/unit/test_strutils.py +++ b/tests/unit/test_strutils.py @@ -198,3 +198,18 @@ class StrUtilsTest(utils.BaseTestCase): ] for v in breaking_examples: self.assertRaises(TypeError, strutils.to_bytes, v) + + def test_slugify(self): + to_slug = strutils.to_slug + self.assertRaises(TypeError, to_slug, True) + self.assertEqual(six.u("hello"), to_slug("hello")) + self.assertEqual(six.u("two-words"), to_slug("Two Words")) + self.assertEqual(six.u("ma-any-spa-ce-es"), + to_slug("Ma-any\t spa--ce- es")) + self.assertEqual(six.u("excamation"), to_slug("exc!amation!")) + self.assertEqual(six.u("ampserand"), to_slug("&ser$and")) + self.assertEqual(six.u("ju5tnum8er"), to_slug("ju5tnum8er")) + self.assertEqual(six.u("strip-"), to_slug(" strip - ")) + self.assertEqual(six.u("perche"), to_slug("perch\xc3\xa9")) + self.assertEqual(six.u("strange"), + to_slug("\x80strange", errors="ignore")) |