From 9b281044c257adc951e50ec7ebc1d46f09a1eef3 Mon Sep 17 00:00:00 2001 From: proofcheck-e2e Date: Tue, 13 Oct 2026 19:06:54 -0400 Subject: [PATCH] proofcheck e2e: [proofcheck e2e] Refactor slugify (no behaviour change) --- e2e_toy/tests/test_textops.py | 4 ++-- e2e_toy/textops.py | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) 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):