def test_peek():
    word = 'one'
    scaner = lexicon.scan('bear')

    assert_equal(parser.peek(word), 'o')
    assert_equal(parser.peek(scaner), 'noun')
    assert_equal(parser.peek(None), None)
Пример #2
0
def test_peek():
    assert_equal(parser.peek([('direction', 'north')]), 'direction')
    assert_equal(parser.peek([('verb', 'go'), ('direction', 'north')]), 'verb')
    assert_equal(
        parser.peek([('stop', 'of'), ('number', 1234), ('noun', 'princess')]),
        'stop')
    assert_equal(parser.peek([]), None)
def test_peek():
    # test an empty word_list returns None
    word_list = ()
    assert_equal(parser.peek(word_list), None)
    
    # test a none empty word_list returns the correct word
    word_list = [('verb', 'run'), ('noun', 'bear')]
    assert_equal(parser.peek(word_list), 'verb')
def test_peek():
    word_list = []
    assert None == parser.peek(word_list)

    word_list = [('noun', 'bear'), ('verb', 'go')]
    assert 'noun' == parser.peek(word_list)

    word_list = lexicon.scan('princess kill bear')
    assert 'noun' == parser.peek(word_list)
Пример #5
0
def test_peek():
    assert_equal(parser.peek(lexicon.scan("north south east west")),
                 "direction")
    assert_equal(parser.peek(lexicon.scan("NORTH south east west")),
                 "direction")
    assert_equal(parser.peek(lexicon.scan("moo ias blargh")), 'error')
    #result = parser.peek(lexicon.scan("north, south, "))
    result = parser.peek(
        lexicon.scan("north south east west up downn left right"))
    assert_equal(result, 'direction')
Пример #6
0
def test_peek():

    test_list = [('noun', 'princess')]
    result = parser.peek(test_list)
    assert_equal(result, 'noun')

    test_list = [('verb', 'go'), ('noun', 'princess'), ('direction', 'east')]
    result = parser.peek(test_list)
    assert_equal(result, 'verb')

    test_list = []
    result = parser.peek(test_list)
    assert_equal(result, None)
Пример #7
0
def test_peek():

    test_list = [('noun', 'princess')]
    result = parser.peek(test_list)
    assert_equal(result, 'noun')


    test_list = [('verb', 'go'),
                ('noun', 'princess'),
                ('direction', 'east')]
    result = parser.peek(test_list)
    assert_equal(result, 'verb')

    test_list = []
    result = parser.peek(test_list)
    assert_equal(result, None)
Пример #8
0
def test_peek():

    assert_equal(parser.peek(word_list), word_type)
Пример #9
0
def test_peek():
	assert_equal(parser.peek([('noun', 'princess')]), 'noun')
Пример #10
0
def test_peek():
    assert_equal(parser.peek(testsentence), testsentence[0])
Пример #11
0
def testing_peek():
    '''testing the peek function.'''
    word_list = lexicon.scan('bear')
    assert_equal(parser.peek(word_list), 'noun')
    assert_equal(parser.peek(None), None)
Пример #12
0
def test_peek():
    assert_equal(parser.peek([]), None)  # Empty List
    result = parser.peek([('verb', 'run'), ('direction', 'north')])
    assert_equal(result, 'verb')
Пример #13
0
def test__peek():
    words = [("direction", "north"), ("noun", "bear")]
    words2 = [("direction", "north"), ("noun", "bear")]
    word = parser.peek(words)
    assert_equal(("direction", "north"), word)
    assert_equal(words, words2)
Пример #14
0
def test_peek():
    word_list = lexicon.scan("bear eat cake")
    assert_equal(parser.peek(word_list),"noun")
    assert_equal(parser.peek(None),None)
Пример #15
0
def test_peek():
	# check peeking on empty word list, list with 1 item, list with many items
	assert_equal(parser.peek([]), None)
	assert_equal(parser.peek(lexicon.scan("north")), "direction")
	assert_equal(parser.peek(lexicon.scan("go north now")), "verb")
Пример #16
0
def test_peek():
    word_list = [('noun', 'Dog'), ('verb', 'ran'), ('stop', 'to'), ('stop', 'the'), ('noun', 'cow')]
    assert_equal(parser.peek(word_list), 'noun')
Пример #17
0
def test_peek():
    assert_equal(parser.peek([('direction', 'south'), ('direction', 'east')]),
                 'direction')
    assert_equal(parser.peek([]), None)
Пример #18
0
def test_peek():
    word_list = lexicon.scan("open the door")
    assert_equal(parser.peek(word_list), "verb")
Пример #19
0
def test_peek():
	word_list = lexicon2.scan('princess') #We need to compare this to the outcome of parser.peek
	assert_equal(parser.peek(word_list), 'noun')
Пример #20
0
def test_peek():
    word_list = []
    assert None == parser.peek(word_list)

    word_list = lexicon.scan("princess kill bear")
    assert "noun" == parser.peek(word_list)
Пример #21
0
def test_peek():
    word_list = lexicon.scan('eat the bear bla')
    assert_equal(parser.peek(word_list), 'verb')
    assert_equal(parser.peek([]), None)
    assert_equal(parser.peek(None), None)
Пример #22
0
def test_peek():
    assert_equal(parser.peek([('verb', 'kill')]), 'verb')
    assert_equal(None, None)
Пример #23
0
def test_peek():
    wordlist = wordlist = [("verb", "kill"), ("stop", "the"),
                           ("noun", "princess")]
    assert_equal(parser.peek(wordlist), "verb")
    assert_equal(parser.peek(""), None)
Пример #24
0
def TestPeek():
    inputsent = lexicon.scan("bear eat castle")
    firstwordtype = parser.peek(inputsent)
    assert_equal(firstwordtype, "noun")
Пример #25
0
def test_peek():
  test = [('noun', 'bear')]
  assert_equal(parser.peek(test), 'noun')
  assert_equal(parser.peek(None), None)
Пример #26
0
def test_peek():
    word_list = lexicon.scan("princess")
    assert_equal(parser.peek(word_list), "noun")
    assert_equal(parser.peek(None), None)
Пример #27
0
def test_peek():
    word_list = lexicon.scan('princess')
    assert_equal(parser.peek(word_list), 'noun')
    assert_equal(parser.peek(None), None)
def test_peek():
    word_list = lexicon.scan("open the door")
    assert_equal(parser.peek(word_list), 'verb')
Пример #29
0
def test_peek():
    word_list = lexicon.scan('princess')
    assert_equal(parser.peek(word_list), 'noun')
    assert_equal(parser.peek(None), None)
Пример #30
0
def test_peek():
    x = parser.peek([("noun", "bear")])
    assert_equal(x, "noun")