def test_n_chars_per_word(doc, words): n_doc = basics.n_chars_per_word(doc) n_words = basics.n_chars_per_word(words) n_expected = ( 4, 5, 5, 2, 2, 5, 3, 6, 5, 7, 9, 7, 3, 2, 8, 4, 7, 9, 4, 3, 6, 4, 3, 2, 8, 3, ) assert n_doc == n_words == n_expected
def test_n_long_words(words, min_n_chars, n_exp): n_chars_per_word = basics.n_chars_per_word(words) n_long_words = basics.n_long_words(n_chars_per_word, min_n_chars=min_n_chars) assert n_long_words == n_exp
def test_n_chars(words): n_chars_per_word = basics.n_chars_per_word(words) n_chars = basics.n_chars(n_chars_per_word) assert n_chars == 126
def test_n_chars(words): n_chars_per_word = basics.n_chars_per_word(words) n_chars = basics.n_chars(n_chars_per_word) assert n_chars == pytest.approx(126, rel=0.05)