From ce8e01ed49fba035cb7857005c27aa822f962f0a Mon Sep 17 00:00:00 2001 From: Funan Zhou Date: Tue, 31 Mar 2026 03:12:00 +0800 Subject: [PATCH] Add edge case test for whitespace-only input This test verifies that slugify correctly returns an empty string when the input contains only whitespace (spaces, tabs, newlines). Test cases include: - Spaces only - Tabs and newlines - Mixed whitespace characters - Empty string No breaking changes introduced. --- test.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test.py b/test.py index fcec4b6..47493f3 100644 --- a/test.py +++ b/test.py @@ -12,6 +12,24 @@ class TestSlugify(unittest.TestCase): + def test_whitespace_only_input(self): + """Test that whitespace-only input returns an empty string.""" + txt = " " + r = slugify(txt) + self.assertEqual(r, "") + + txt = "\t\n" + r = slugify(txt) + self.assertEqual(r, "") + + txt = " \n \t " + r = slugify(txt) + self.assertEqual(r, "") + + txt = "" + r = slugify(txt) + self.assertEqual(r, "") + def test_extraneous_seperators(self): txt = "This is a test ---"