Debian Codegraph @

adventure/tests/test_commands.py

raw
1 """Test suite.
2
3 Copyright 2010-2015 Brandon Rhodes. Licensed as free software under the
4 Apache License, Version 2.0 as detailed in the accompanying README.txt.
5
6 """
7 from unittest import TestCase
8 from adventure import load_advent_dat
9 from adventure.game import Game
10
11 class CommandTest(TestCase):
12
13 def setUp(self):
14 game = Game()
15 load_advent_dat(game)
16 self.words = set(w.synonyms[0].text for w in game.vocabulary.values())
17 self.words.remove('suspend')
18
19 def test_intransitive_commands_should_not_throw_exceptions(self):
20 for word in self.words:
21 game = Game()
22 load_advent_dat(game)
23 game.start()
24 game.do_command(['no']) # WOULD YOU LIKE INSTRUCTIONS?
25 game.do_command([word])
26
27 def test_transitive_commands_should_not_throw_exceptions(self):
28 for word in self.words:
29 game = Game()
30 load_advent_dat(game)
31 game.start()
32 game.do_command(['no']) # WOULD YOU LIKE INSTRUCTIONS?
33 game.do_command(['enter']) # so we are next to lamp
34 game.do_command([word, 'lamp'])