def test_skip(): word_list = lexicon.scan('eat the bear bla') assert_equal(word_list, [('verb', 'eat'), ('stop', 'the'), ('noun', 'bear'), ('error', 'bla')]) parser.skip(word_list, 'verb') assert_equal(word_list, [('stop', 'the'), ('noun', 'bear'), ('error', 'bla')]) parser.skip(word_list, 'stop') assert_equal(word_list, [('noun', 'bear'), ('error', 'bla')])
def test_skip(): assert_equal( parser.skip([('stop', 'at'), ('stop', 'the'), ('noun', 'planet')], 'stop'), None) assert_equal( parser.skip([('stop', 'at'), ('stop', 'the'), ('noun', 'planet')], 'noun'), None)
def testing_skip(): '''testing the skip function.''' word_list = lexicon.scan('bear kill princess') assert_equal(word_list, [('noun', 'bear'), ('verb', 'kill'), ('noun', 'princess')]) parser.skip(word_list, 'noun') assert_equal(word_list, [('verb', 'kill'), ('noun', 'princess')])
def TestSkip(): inputsent = lexicon.scan("bear eat castle") assert_equal(inputsent, [('noun', 'bear'), ('verb', 'eat'), ('noun', 'castle')]) parser.skip(inputsent, 'noun') assert_equal(inputsent, [('verb', 'eat'), ('noun', 'castle')]) parser.skip(inputsent, 'verb') assert_equal(inputsent, [('noun', 'castle')])
def test_skip(): # skiping with an empty list word_list = [] parser.skip(word_list, "noun") assert_equal(word_list, []) # skipping with a list with 1 item word_list = lexicon.scan("in") parser.skip(word_list, "noun") assert_equal(word_list, [("stop", "in")]) parser.skip(word_list, "stop") assert_equal(word_list, []) # skipping with lists with many items word_list = lexicon.scan("in of from") parser.skip(word_list, "stop") assert_equal(word_list, []) word_list = lexicon.scan("Go up or down") parser.skip(word_list, "verb") assert_equal(word_list, [("direction", "up"), ("error", "or"), ("direction", "down")])
def test_skip(): word_list = lexicon2.scan('princess') assert_equal(word_list, [('noun', 'princess')]) parser.skip(word_list, 'noun')
def test_skip(): words = [('stop', 'the'), ('noun', 'girl')] parser.skip(words, 'stop') assert_equal(words, [('noun', 'girl')])
def test_skip(): # test to see if skip removes the first lot of stop words it comes accross word_list = [('stop', 'at'), ('stop', 'the'), ('verb', 'run'), ('stop', 'is')] parser.skip(word_list, 'stop') # word_list should be left with a verb then another stop word assert_equal(word_list, [('verb', 'run'), ('stop', 'is')])
def skip(): word_list = [] assert None == parser.skip(word_list) word_list = lexicon.scan("bear go princess")
def test_skip(): word_list = lexicon.scan(sentence) assert_equal(word_list, [('noun','princess'), ('verb','go'), ('direction', 'east')]) parser.skip(word_list, 'noun') assert_equal(word_list, [('verb','go'), ('direction', 'east')])
def test_skip(): word_list = lexicon.scan("the door") parser.skip(word_list, "stop") assert_equal(word_list, [("noun", "door")])
def test_skip(): assert_equal(parser.skip("of", "stop"), (None)) result = parser.skip("of", "stop")
def test_skip(): #该函数会跳过和制定的词语类型相同的所有的tuple assert_equal(parser.skip([('verb', 'kill'), ('noun', 'princess')], 'verb'), None) assert_equal(parser.skip([('noun', 'princess'), ('verb', 'kill')], 'verb'), None)
def test_skip(): scanner = lexicon.scan("north bear go") assert_equal(scanner, [('direction', 'north'), ('noun', 'bear'), ('verb', 'go')]) assert_equal(parser.skip(scanner, 'direction'), None) assert_equal(scanner, [('noun', 'bear'), ('verb', 'go')])
def test_skip(): word_list_eg = [('verb', 'run'), ('direction', 'north'), ('stop', 'with'), ('stop', 'the'), ('noun', 'bear')] assert_equal(parser.skip(word_list_eg, 'stop'), None)
def test_skip(): wordlist = [("verb", "kill"), ("stop", "the"), ("noun", "princess")] assert_equal(parser.skip(wordlist, "kill"), None)
def test_skip(): test = [('verb', 'punch'), ('noun', 'bear')] parser.skip(test, 'verb') assert_equal(test, [('noun', 'bear')]) parser.skip(test, 'noun') assert_equal(test, [])
def test_skip(): word_list = lexicon.scan("bear eat cake") assert_equal(word_list,[("noun","bear"),("verb","eat"),("noun","cake")]) parser.skip(word_list,"noun") assert_equal(word_list,[("verb","eat"),("noun","cake")])
def test_skip(): word_list = lexicon.scan('bear eat door') assert_equal(word_list, [('noun', 'bear'), ('verb', 'eat'), ('noun', 'door')]) parser.skip(word_list, 'noun') assert_equal(word_list, [('verb', 'eat'), ('noun', 'door')])
def test_skip(): word_list = lexicon.scan("the door") parser.skip(word_list, 'stop') assert_equal(word_list, [('noun', 'door')])
def test_skip(): x = parser.skip([("stop", "the"), ("noun", "bear")], 'stop') #Should return none because the thing at index 0 #Won't match stop assert_equal(x, None)