File: test_utils.py

package info (click to toggle)
pyenchant 3.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 368 kB
  • sloc: python: 2,936; makefile: 37
file content (12 lines) | stat: -rw-r--r-- 509 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
from enchant.utils import trim_suggestions


def test_trim_suggestions():
    word = "gud"
    suggs = ["good", "god", "bad+"]
    assert trim_suggestions(word, suggs, 40) == ["god", "good", "bad+"]
    assert trim_suggestions(word, suggs, 4) == ["god", "good", "bad+"]
    assert trim_suggestions(word, suggs, 3) == ["god", "good", "bad+"]
    assert trim_suggestions(word, suggs, 2) == ["god", "good"]
    assert trim_suggestions(word, suggs, 1) == ["god"]
    assert trim_suggestions(word, suggs, 0) == []