コード例 #1
0
ファイル: test_app.py プロジェクト: swilcox/zorkdemo
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.""")
コード例 #2
0
ファイル: test_app.py プロジェクト: swilcox/zorkdemo
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)))
コード例 #3
0
ファイル: test_app.py プロジェクト: swilcox/zorkdemo
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.""")
コード例 #4
0
ファイル: test_app.py プロジェクト: swilcox/zorkdemo
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.')
コード例 #5
0
ファイル: test_app.py プロジェクト: swilcox/zorkdemo
def test_open_opened_mailbox():
    adventure = Adventure()
    adventure.open(['mailbox'])
    assert(adventure.open(['mailbox']) == "The mailbox is already open.")
コード例 #6
0
ファイル: test_app.py プロジェクト: swilcox/zorkdemo
def test_house_open_mailbox():
    adventure = Adventure()
    assert(adventure.open(['mailbox']) == "You open the mailbox, revealing a small leaflet.")
コード例 #7
0
ファイル: test_app.py プロジェクト: swilcox/zorkdemo
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.')
コード例 #8
0
ファイル: test_app.py プロジェクト: swilcox/zorkdemo
def test_empty_mailbox():
    adventure = Adventure()
    adventure.open(['mailbox'])
    adventure.take(['leaflet'])
    adventure.close(['mailbox'])
    assert (adventure.open(['mailbox']) == """You open the mailbox.""")
コード例 #9
0
ファイル: test_app.py プロジェクト: swilcox/zorkdemo
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.""")
コード例 #10
0
ファイル: test_app.py プロジェクト: swilcox/zorkdemo
def test_take_leaflet_and_mat():
    adventure = Adventure()
    adventure.open(['mailbox'])
    assert(adventure.take(['leaflet', 'mat']) == """leaflet: Taken.
mat: Taken.""")