Example #1
0
    def test_two_way_exit(self):
        game = vengeance.create_game({
            'directions': [
                {'name': 'up', 'opposite': 'down'},
            ],
            'rooms': [
                {'name': 'Room A',
                 'description': 'A',
                 'exits': [
                     {'to': 'Room B', 'direction': 'down'}
                 ]},
                {'name': 'Room B',
                 'description': 'B'}
            ]
        })

        room_a = game.find_location('Room A')
        self.assertEqual(1, len(room_a.exits))
        room_b = game.find_location('Room B')
        self.assertEqual(1, len(room_b.exits))
Example #2
0
    def test_exit_direction(self):
        exit_direction = 'down'

        game = vengeance.create_game({
            'directions': [
                {'name': 'up', 'opposite': exit_direction},
            ],
            'rooms': [
                {'name': 'Room A',
                 'description': 'A',
                 'exits': [
                     {'to': 'Room B', 'direction': exit_direction}
                 ]},
                {'name': 'Room B',
                 'description': 'B'}
            ]
        })

        exit = game.find_location('Room A').exits[0]
        self.assertEqual(exit_direction, exit.direction.name)