def test_match(): test = Sentence.match([('verb', 'eat')], 'verb') assert_equal(test, ('verb', 'eat')) test2 = Sentence.match([('noun', 'bear')], 'verb') assert_equal(test2, None)
def test_peek(): assert_equal(Sentence.peek([('verb', 'eat')]), 'verb') assert_equal(Sentence.peek([('noun', 'bear')]), 'noun')
def test_parse_verb(): test = Sentence.parse_verb([('verb', 'eat')]) assert_equal(test, ('verb', 'eat')) assert_raises(ParseError, Sentence.parse_verb, [('noun', 'bear')])
def test_parse_subject(): test = Sentence.parse_subject([('noun', 'bear')]) test2 = Sentence.parse_subject([('verb', 'kill')]) assert_equal(test, ('noun', 'bear')) assert_equal(test2, ('noun', 'player')) assert_raises(ParseError, Sentence.parse_subject, [('direction', 'bear')])
def test_parse_verb(): test = Sentence.parse_verb([('noun', 'bear'), ('stop', 'the')]) assert_raises(ParseError, )