Skip to content

Instantly share code, notes, and snippets.

@LucasMagnum
Created November 5, 2018 09:49
Show Gist options
  • Select an option

  • Save LucasMagnum/d637f485e253a2da12f26a2e2fd5f3d8 to your computer and use it in GitHub Desktop.

Select an option

Save LucasMagnum/d637f485e253a2da12f26a2e2fd5f3d8 to your computer and use it in GitHub Desktop.

Revisions

  1. Lucas Magnum created this gist Nov 5, 2018.
    27 changes: 27 additions & 0 deletions test_words_analysis.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    import unittest

    from words_analysis import get_most_common_words


    class TestWordsAnalysis(unittest.TestCase):

    def test_get_most_common_words_should_return_the_expected_words(self):
    data = [
    'python',
    'ruby',
    'java',
    'python',
    'earlang',
    'java',
    'golang',
    'javascript',
    'python'
    ]

    expected = [
    ('python', 3),
    ('java', 2)
    ]

    most_common_words = get_most_common_words(data, 2)
    assert most_common_words == expected