summaryrefslogtreecommitdiff
path: root/cbse/data/broken.py
diff options
context:
space:
mode:
Diffstat (limited to 'cbse/data/broken.py')
-rw-r--r--cbse/data/broken.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/cbse/data/broken.py b/cbse/data/broken.py
new file mode 100644
index 0000000..2f5278c
--- /dev/null
+++ b/cbse/data/broken.py
@@ -0,0 +1,27 @@
+def count_words(text):
+ result = {}
+ for word in text.lower().split():
+ result[word] += 1
+ return result
+
+
+def test_simple():
+ text = 'one'
+ res = count_words(text)
+ assert res['one'] == 1
+ assert len(res) == 1
+
+
+def test_count_words():
+ # Given
+ text = 'one two Two three THREE three'
+ # When
+ res = count_words(text)
+ # Then
+ assert res['one'] == 1
+ assert res['two'] == 2
+ assert res['three'] == 3
+
+
+if __name__ == '__main__':
+ test_count_words()