summaryrefslogtreecommitdiff
path: root/cbse/data/broken.py
blob: 2f5278c3c4f9cb9088ae6e469272e9aa659d34d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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()