2 One more test

just setup

An empty text has no words, and count must give an empty dictionary for it. A test of an empty text says so. It passes at once, because count already handles it.

uv run python -m unittest discover -s tests -v
echo "" | uv run tally && echo "(nothing, as the test says)"

The three tests pass, and tally prints nothing for an empty text.

What changed

  • tests/test_empty.py: an empty text counts nothing. New, 8 lines. The file.
    • look at self.assertEqual(count(""), {})
The diff of tests/test_empty.py
@@ -0,0 +1,8 @@
+import unittest
+
+from tally import count
+
+
+class Empty(unittest.TestCase):
+    def test_empty(self):
+        self.assertEqual(count(""), {})

This change on GitHub. The code after it.