コード例 #1
0
def test_nsyl_best_guess():
     r = Ranalyzer("The quick brown fox jumps over the lazy dog.")
     assert_equal(r._nsyl_best_guess("monosyllabic"), 5)
コード例 #2
0
def test_grade_level():
    f = open('tests/sample.txt', 'r')
    r = Ranalyzer(f.read())
    f.close()
    assert_equal(r.grade_level(), 7)
コード例 #3
0
def test_gunning_fog():
    f = open('tests/sample.txt', 'r')
    r = Ranalyzer(f.read())
    f.close()
    assert_equal(r.gunning_fog(), 9.57)
コード例 #4
0
def test_reading_ease():
    f = open('tests/sample.txt', 'r')
    r = Ranalyzer(f.read())
    f.close()
    assert_equal(r.reading_ease(), 63)
コード例 #5
0
def test_nsyl():
    r = Ranalyzer("The quick brown fox jumps over the lazy dog.")
    assert_equal(r._nsyl("syllable")[0], 3)
    assert_raises(UnknownWordError, r._nsyl, "monosyllabic")
コード例 #6
0
def test_word():
    r = Ranalyzer("The gentleman will not be allergic to my medicine.")
    assert_equal(r._nsyl("medicine")[0], 3)
コード例 #7
0
def test_total_complex_words():
    r = Ranalyzer("The gentleman will not be allergic to my medicine.")
    assert_equal(r._total_complex_words(), 3)
コード例 #8
0
def test_total_words():
    f = open('tests/sample.txt', 'r')
    r = Ranalyzer(f.read())
    f.close()
    assert_equal(r._total_words(), 161)
コード例 #9
0
def test_total_sentences():
    r = Ranalyzer("The fox was a bit of a dick. The dog ate his mother. Whose mother, he asked? Why, mother Jones of course!")
    assert_equal(r._total_sentences(), 4)
コード例 #10
0
def test_total_syllables():
    r = Ranalyzer("The quick brown fox jumps over the lazy dog.")
    assert_equal(r._total_syllables(), 11)