def test_wrong_exit_1_2():
    # to test the output in case of no exit
    assert world.if_exit("1", "S") == ("No exit that way", "1", '\n')
示例#2
0
import world

maps = world.load_file()
player_pos = maps["PLAYER"]
print(maps[player_pos][0])
while True:
    direction = input("Enter Direction: ")
    description, player_pos, object_in_room  = world.if_exit(player_pos, direction)
    print(description)
    print(object_in_room)
    print(world.get_exits(player_pos))
    world.save_file(maps)
    
    
def test_wrong_exit_0_3():
    # to test the output in case of no exit
    assert world.if_exit("0", "W") == ("No exit that way", "0", '\n')
def test_correct_exit_0_4():
    # to test in case of correct exit
    assert world.if_exit(
        "0", "S") == ("You are standing in what seems to be a living room.",
                      '1', "There is a blue vase in the room.\n")
def test_correct_exit_9_4():
    # to test in case of correct exit
    assert world.if_exit(
        "9", "S") == ('You are standing in the balcony of room number 9.',
                      '11', '\n')
def test_correct_exit_11_4():
    # to test in case of correct exit
    assert world.if_exit("11", "N") == (
        'You are standing in another bedroom. You can see a door that seems to lead to a balcony number 3.',
        '9', '\n')
def test_wrong_exit_9_1():
    # to test the output in case of no exit
    assert world.if_exit("9", "E") == ("No exit that way", "9", '\n')
def test_correct_exit_9_3():
    # to test in case of correct exit
    assert world.if_exit("9", "N") == (
        'You are standing in a connecting hallway. Three doors await you.',
        '6', '\n')
def test_correct_exit_6_3():
    # to test in case of correct exit
    assert world.if_exit(
        "6", "E") == ('You are standing in a kitchen. Utensils everywhere.',
                      '7', "You can see a knife in front of you.\n")
def test_correct_exit_8_3():
    # to test in case of correct exit
    assert world.if_exit(
        "8", "S") == ('You are standing in the balcony of room number 8.',
                      '10', '\n')
def test_correct_exit_6_2():
    # to test in case of correct exit
    assert world.if_exit("6", "N") == (
        'You are standing in what seems to be a hall way connecting many room.',
        '2', '\n')
def test_correct_exit_4_4():
    # to test in case of correct exit
    assert world.if_exit("4", "W") == (
        'Your are standing in what seems to be a bedroom. It has got a balcony attached.',
        '3', '\n')
def test_correct_exit_3_4():
    # to test in case of correct exit
    assert world.if_exit(
        "3", "E") == ('You are standing in the balcony of Room number 3.', '4',
                      '\n')
def test_correct_exit_2_3():
    # to test in case of correct exit
    assert world.if_exit(
        "2",
        "E") == ('You are standing in the balcony attached to the hallway.',
                 '5', "There is a red tennis ball in front of you.\n")
def test_correct_exit_1_4():
    # to test in case of correct exit
    assert world.if_exit("1", "N") == (
        "You are standing at the end of a corridor. There is a door in front of you.",
        '0', '\n')