示例#1
0
 def test_sanitize_nosubwords(self):
     wordlist = ["short", "word", "is", "his"]
     expect = ["short", "word", "his"]
     reject = []
     test = WStext(wordlist, maxlength = 11)
     good, bad = test.sanitize_nosubwords(wordlist, reject)
     assert good == expect
     assert bad == ["is"]
     wordlist = ["short", "notshorter", "longing", "long", "verylongword"]
     expect = ["notshorter", "longing", "verylongword"]
     reject = []
     test = WStext(wordlist)
     good, bad = test.sanitize_nosubwords(wordlist, reject)
     assert good == expect
     assert bad == ["short", "long"]
示例#2
0
 def test_sanitize_nosubwords(self):
     wordlist = ["short", "word", "is", "his"]
     expect = ["short", "word", "his"]
     reject = []
     test = WStext(wordlist, maxlength=11)
     good, bad = test.sanitize_nosubwords(wordlist, reject)
     assert good == expect
     assert bad == ["is"]
     wordlist = ["short", "notshorter", "longing", "long", "verylongword"]
     expect = ["notshorter", "longing", "verylongword"]
     reject = []
     test = WStext(wordlist)
     good, bad = test.sanitize_nosubwords(wordlist, reject)
     assert good == expect
     assert bad == ["short", "long"]