def test_make_words_simple(): """ make sure the basics work! """ all_words = trigrams.make_words("A really simple sentence.") assert len(all_words) == 4
def test_make_words_I(): """ I should be capitalized """ all_words = trigrams.make_words(TEXT_WITH_PUNC) assert "i" not in all_words assert "I" in all_words
def test_make_words_dashes(): """ all dashes should be removed """ # put them all back together for easier checking all_words = " ".join(trigrams.make_words(TEXT_WITH_PUNC)) assert "-" not in all_words
def test_make_words_single_quote(): """ no double quotes no single quotes by themselves, but preserved when an apostrophe """ # put them all back together for easier checking text = """ "Not at all. The 'G' with the small 't' stands for 'Gesellschaft,' which isn't the German for 'Company.' """ all_words = trigrams.make_words(text) print(all_words) # no double quotes assert '"' not in " ".join(all_words) # apostophe preserved assert "isn't" in all_words # none of the words should start or end with a single quote for word in all_words: assert not word.startswith("'") assert not word.endswith("'")