Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions e2e_toy/tests/test_textops.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ def test_single_spaces(self):

class SlugifyTest(unittest.TestCase):
def test_basic(self):
self.assertEqual(slugify("Hello World"), "hello-world")
self.assertEqual(slugify("Hello World"), "hello_world")

def test_extra_spaces(self):
self.assertEqual(slugify(" Hello World "), "hello-world")
self.assertEqual(slugify(" Hello World "), "hello_world")


class ClampTest(unittest.TestCase):
Expand Down
8 changes: 5 additions & 3 deletions e2e_toy/textops.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ def word_count(text):


def slugify(text):
"""Lowercase ``text`` and join its words with single dashes."""
words = [w for w in text.lower().split() if w]
return "-".join(words)
"""Lowercase ``text`` and join its words with single separators."""
return _SEPARATOR.join(text.lower().split())


_SEPARATOR = "_"


def clamp(value, low, high):
Expand Down
Loading