From 237a3dfcc3c109200b922e980ed4a4bc9b047a3f Mon Sep 17 00:00:00 2001 From: proofcheck-e2e Date: Tue, 13 Oct 2026 19:07:02 -0400 Subject: [PATCH] proofcheck e2e: [proofcheck e2e] Fix word_count with repeated whitespace --- e2e_toy/tests/test_textops.py | 4 ++++ e2e_toy/textops.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/e2e_toy/tests/test_textops.py b/e2e_toy/tests/test_textops.py index e05680d..f4c21cf 100644 --- a/e2e_toy/tests/test_textops.py +++ b/e2e_toy/tests/test_textops.py @@ -7,6 +7,10 @@ class WordCountTest(unittest.TestCase): def test_single_spaces(self): self.assertEqual(word_count("a b c"), 3) + def test_repeated_spaces(self): + self.assertEqual(word_count("hello world"), 2) + self.assertEqual(word_count(" padded\ttext\n"), 2) + class SlugifyTest(unittest.TestCase): def test_basic(self): diff --git a/e2e_toy/textops.py b/e2e_toy/textops.py index 8f71f6c..359ef78 100644 --- a/e2e_toy/textops.py +++ b/e2e_toy/textops.py @@ -6,7 +6,7 @@ def word_count(text): """Number of whitespace-separated words in ``text``.""" - return len(text.split(" ")) + return len(text.split()) def slugify(text):