def test_word_freq(): """Test word counts for movie titles. NOTE: Any changes to the titles.csv file will break this test""" expected = [ ('day', 3), ('red', 2), ('the', 2), ('big', 1), ('bueller', 1), ('earth', 1), ('ferris', 1), ('fiction', 1), ('grit', 1), ('hood', 1), ('hunt', 1), ('little', 1), ('october', 1), ('off', 1), ('pulp', 1), ('riding', 1), ('still', 1), ('stood', 1), ('thei', 1), ('true', 1) ] a = CSVAnalyzer('test/data/titles.csv') freq = a.word_freq('title') assert_equals(expected, freq.items())
def test_columns(): a = CSVAnalyzer('test/data/titles.csv') assert_equals(['title'], a.columns())
def test_top_words(): """Test word counts for movie titles. NOTE: Any changes to the titles.csv file will break this test""" a = CSVAnalyzer('test/data/titles.csv') top_words = a.top_words('title', 2) assert_equals('word,count\nday,3\nred,2', top_words)