Ejemplo n.º 1
0
def test_one_room ():
  room = """
:Room
This is a room
""".splitlines ()
  rooms, first_location, items, item_location = adventure.load_universe (room)
  assert rooms.keys () == ['Room']
  assert first_location.name == "Room"
Ejemplo n.º 2
0
def test_one_rooms_exits ():
  room = """
:Room
Shut it!
E:Room
W:Room
""".splitlines ()
  rooms, first_location, items, item_location = adventure.load_universe (room)
  assert 'E' in rooms['Room'].exits.keys ()
  assert 'W' in rooms['Room'].exits.keys ()
Ejemplo n.º 3
0
def test_load_item ():
  universe = """
:Balcony
This is a room  
  
*Flowers
Balcony
A wilted bouquet of flowers. There is a card with a note that has been obliterated by rain or tears.
A:bouquet, flower
""".splitlines()
  rooms, first_location, items, item_location = adventure.load_universe (universe)
  assert len(items) == 1
  assert item_location.has_key(adventure.Location("Balcony"))