Skip to content

Instantly share code, notes, and snippets.

@miroli
Created March 7, 2015 21:46
Show Gist options
  • Save miroli/9f2b4d06a9704c8fb77e to your computer and use it in GitHub Desktop.
Save miroli/9f2b4d06a9704c8fb77e to your computer and use it in GitHub Desktop.
import unittest
from pycar_advanced import utils
class UtilsTestCase(unittest.TestCase):
def test_slugify(self):
"""Test utils.slugify"""
# It should:
#
# * Remove punctuation
# * Lowercase characters
# * Convert whitespace to a dash "-"
self.assertEqual(utils.slugify("Cool string!"), "cool-string")
def test_slugify_whitespace(self):
# TODO: slugify should also:
#
# * Remove leading/trailing whitespace
# * Compact consecutive whitespace
self.assertEqual(utils.slugify(" Hey man"), "hey-man")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment