Exemplo n.º 1
0
def test_search_place_full():
    game = Game()
    game.load("games/SearchTest.xml")
    message = "You found a sword\n" \
              + "You found a amulet\n" \
              + "You found a shield\n"
    assert game.search("Forest") == message
Exemplo n.º 2
0
def test_search_basic():
    game = Game()
    game.load("games/SearchTest.xml")
    message = "You found a sword\n" \
              + "You found a amulet\n" \
              + "You found a shield\n"
    assert game.search() == message
Exemplo n.º 3
0
def test_reequip_shield():
    game = Game()
    game.load("games/EquipTest.xml")
    game.pickup("shield+1")
    game.pickup("shield+2")
    game.equip("shield+1")
    assert game.equip("shield+2") == "You equipped your shield+2"
    message = "You look in your backpack:" \
              + "\n\tYou have a shield+1"
    assert game.search("backpack") == message
Exemplo n.º 4
0
def test_search_backpack_full():
    game = Game()
    game.load("games/SearchTest.xml")
    game.pickup("sword")
    game.pickup("amulet")
    game.pickup("shield")
    message = "You look in your backpack:" \
              + "\n\tYou have a sword" \
              + "\n\tYou have a amulet" \
              + "\n\tYou have a shield"
    assert game.search("backpack") == message
Exemplo n.º 5
0
def test_search_nonexistent():
    game = Game()
    game.load("games/SearchTest.xml")
    assert game.search("nonexistent") == "Cannot search nonexistent"
Exemplo n.º 6
0
def test_search_backpack_emptied():
    game = Game()
    game.load("games/SearchTest.xml")
    game.pickup("sword")
    game.equip("sword")
    assert game.search("backpack") == "You look in your backpack:"
Exemplo n.º 7
0
def test_search_backpack_empty():
    game = Game()
    game.load("games/SearchTest.xml")
    assert game.search("backpack") == "You look in your backpack:"
Exemplo n.º 8
0
def test_search_dead_enemy2():
    game = Game()
    game.load("games/SearchTest.xml")
    game.fight("Enemy2")
    assert game.search("Enemy2") == "Found nothing in Enemy2"
Exemplo n.º 9
0
def test_search_dead_enemy1():
    game = Game()
    game.load("games/SearchTest.xml")
    game.fight("Enemy1")
    assert game.search("Enemy1") == "You found a ring\n"
Exemplo n.º 10
0
def test_search_alive_enemy():
    game = Game()
    game.load("games/SearchTest.xml")
    assert game.search(
        "Enemy1") == "You cannot search Enemy1 while it is alive!"
Exemplo n.º 11
0
def test_search_place_empty():
    game = Game()
    game.load("games/SearchTest.xml")
    game.goto("sea")
    assert game.search() == "Found nothing"