def test_add_exit_with_no_opposite_raises(self): direction = Direction('up') location1 = Location(self.arbitrary_name) location2 = Location(self.arbitrary_name + '2') try: location1.add_exit(direction, location2) self.fail() except ValueError: # Success pass
# Use case: Run a procedurally defined game # Example: from vengeance.directions import DOWN, IN, WEST from vengeance.game import Direction from vengeance.game import Game from vengeance.game import Location church = Location('A Church', 'Tiny place of worship') crypt = Location('The Crypt', 'Dusty tomb filled with empty sarcophagi') coffin = Location('A Coffin', 'A tight squeeze and pitch dark') cave = Location('A Cave') church.add_exit(DOWN, crypt) crypt.add_one_way_exit(IN, coffin) crypt.add_exit(WEST, cave) game = Game([church, crypt, coffin, cave]) game.run()