diff --git a/e2e_toy/tests/test_textops.py b/e2e_toy/tests/test_textops.py index e05680d..f59d90e 100644 --- a/e2e_toy/tests/test_textops.py +++ b/e2e_toy/tests/test_textops.py @@ -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): diff --git a/e2e_toy/textops.py b/e2e_toy/textops.py index 8f71f6c..321484b 100644 --- a/e2e_toy/textops.py +++ b/e2e_toy/textops.py @@ -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):