示例#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.""")
示例#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)))
示例#3
0
def test_take_mat_go_north_then_drop_mat():
    adventure = Adventure()
    adventure.take(['mat'])
    adventure.go_north([])
    adventure.drop(['mat'])
    assert (adventure.current_room.description == """**North of House**
You are facing the north side of a white house.  There is no door here, and all the windows are barred.
There is a welcome mat here.""")
示例#4
0
def test_take_and_drop_mat():
    adventure = Adventure()
    adventure.take(['mat'])
    assert(adventure.drop(['mat']) == 'Dropped.')
    assert(adventure.list_inventory([]) == 'You are empty handed.')
    assert(any((item.name == 'mat' for item in adventure.current_room.items)))
示例#5
0
def test_empty_mailbox():
    adventure = Adventure()
    adventure.open(['mailbox'])
    adventure.take(['leaflet'])
    adventure.close(['mailbox'])
    assert (adventure.open(['mailbox']) == """You open the mailbox.""")
示例#6
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.""")
示例#7
0
def test_take_leaflet_and_mat():
    adventure = Adventure()
    adventure.open(['mailbox'])
    assert(adventure.take(['leaflet', 'mat']) == """leaflet: Taken.
mat: Taken.""")