Esempio n. 1
0
def test_take_and_drop_leaflet_and_mat_then_look():
    adventure = Adventure()
    adventure.open(['mailbox'])
    adventure.take(['leaflet', 'mat'])
    adventure.drop(['mat', 'leaflet'])
    assert(adventure.look([]) == """**West of House**
This is an open field west of a white house, with a boarded front door.
There is a small mailbox, a welcome mat, and a small leaflet here.""")
Esempio n. 2
0
def test_take_and_drop_mat_and_leaflet():
    adventure = Adventure()
    adventure.take(['mat'])
    adventure.open(['mailbox'])
    adventure.take(['leaflet'])
    assert(adventure.drop(['mat', 'leaflet']) == 'mat: Dropped.\nleaflet: Dropped.')
    assert(adventure.list_inventory([]) == 'You are empty handed.')
    assert(any((item.name == 'mat' or item.name == item.name == 'leaflet' for item in adventure.current_room.items)))
Esempio n. 3
0
def test_open_mailbox_and_look():
    adventure = Adventure()
    adventure.open(['mailbox'])
    assert(adventure.look([]) == """**West of House**
This is an open field west of a white house, with a boarded front door.
There is a small mailbox here.
The mailbox contains:
- A small leaflet.
A rubber mat saying 'Welcome to Zork!' lies by the door.""")
Esempio n. 4
0
def test_house_open_mailbox_read_leaflet():
    adv = Adventure()
    adv.open(['mailbox'])
    assert(adv.examine(['leaflet']) == '(Taking the leaflet first)\n'
                                       '    ZORK is a game of adventure, danger, and low cunning.  In it you will '
                                       'explore some of the most amazing territory ever seen by mortal man.  Hardened '
                                       'adventurers have run screaming from the terrors contained within!\n\n'
                                       '    In ZORK the intrepid explorer delves into the forgotten secrets of a lost '
                                       'labyrinth deep in the bowels of the earth, searching for vast treasures long '
                                       'hidden from prying eyes, treasures guarded by fearsome monsters and diabolical '
                                       'traps!\n\n'
                                       '    No PDP-10 should be without one!\n\n'
                                       '    ZORK was created at the MIT Laboratory for Computer Science, by Tim '
                                       'Anderson, Marc Blank, Bruce Daniels, and Dave Lebling.  It was inspired by the '
                                       'ADVENTURE game of Crowther and Woods, and the long tradition of fantasy and '
                                       'science fiction adventure.  ZORK was originally written in MDL (alias MUDDLE). '
                                       'The current version was written by Brandon Corfman.')
Esempio n. 5
0
def test_open_opened_mailbox():
    adventure = Adventure()
    adventure.open(['mailbox'])
    assert(adventure.open(['mailbox']) == "The mailbox is already open.")
Esempio n. 6
0
def test_house_open_mailbox():
    adventure = Adventure()
    assert(adventure.open(['mailbox']) == "You open the mailbox, revealing a small leaflet.")
Esempio n. 7
0
def test_house_read_leaflet_check_inventory():
    adventure = Adventure()
    adventure.open(['mailbox'])
    adventure.examine(['leaflet'])
    assert(adventure.list_inventory([]) == 'You are holding a small leaflet.')
Esempio n. 8
0
def test_empty_mailbox():
    adventure = Adventure()
    adventure.open(['mailbox'])
    adventure.take(['leaflet'])
    adventure.close(['mailbox'])
    assert (adventure.open(['mailbox']) == """You open the mailbox.""")
Esempio n. 9
0
def test_inventory_after_taking_mat_and_leaflet():
    adventure = Adventure()
    adventure.open(['mailbox'])
    adventure.take(['mat', 'leaflet'])
    assert(adventure.list_inventory([]) == """You are holding a welcome mat and a small leaflet.""")
Esempio n. 10
0
def test_take_leaflet_and_mat():
    adventure = Adventure()
    adventure.open(['mailbox'])
    assert(adventure.take(['leaflet', 'mat']) == """leaflet: Taken.
mat: Taken.""")