def test_look_object_equipped_shield():
    game = Game()
    game.load("games/LookTest.xml")
    game.pickup("shield")
    game.equip("shield")
    assert game.look_at(
        "shield") == "Just a lousy shield. You have it equipped"
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
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
def test_look_object_switch_equipped_weapon():
    game = Game()
    game.load("games/LookTest.xml")
    game.pickup("sword")
    game.pickup("sword2")
    game.equip("sword")
    assert game.look_at("sword") == "Just a lousy sword. You have it equipped"
    assert game.look_at("sword2") == "Another sword"
    game.equip("sword2")
    assert game.look_at("sword") == "Just a lousy sword"
    assert game.look_at("sword2") == "Another sword. You have it equipped"
def test_look_object_in_backpack():
    game = Game()
    game.load("games/LookTest.xml")
    game.pickup("sword")
    assert game.look_at("sword") == "Just a lousy sword"
def test_cannot_equip():
    game = Game()
    game.load("games/EquipTest.xml")
    game.pickup("amulet")
    assert game.equip("amulet") == "You can't equip amulet"
def test_equip_equipped_shield():
    game = Game()
    game.load("games/EquipTest.xml")
    game.pickup("shield+1")
    game.equip("shield+1")
    assert game.equip("shield+1") == "shield+1 is already equipped"
def test_equip_shield():
    game = Game()
    game.load("games/EquipTest.xml")
    game.pickup("shield+1")
    assert game.equip("shield+1") == "You equipped your shield+1"
def test_equip_weapon():
    game = Game()
    game.load("games/EquipTest.xml")
    game.pickup("sword+1")
    assert game.equip("sword+1") == "You equipped your sword+1"
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:"
def test_pick_up_nonexistent():
    game = Game()
    game.load("games/LookTest.xml")
    assert game.pickup("nonexistent") == "Cannot pickup nonexistent"
def test_pick_up_from_dead_enemy():
    game = Game()
    game.load("games/LookTest.xml")
    game.fight("Enemy1")
    assert game.pickup("ring") == "You just picked up a ring"
def test_pick_up_from_alive_enemy():
    game = Game()
    game.load("games/LookTest.xml")
    assert game.pickup("ring") == "Cannot pickup ring"
def test_already_picked_up():
    game = Game()
    game.load("games/LookTest.xml")
    game.pickup("sword")
    assert game.pickup("swoRd") == "Cannot pickup swoRd"
def test_basic_pickup():
    game = Game()
    game.load("games/LookTest.xml")
    assert game.pickup("swoRd") == "You just picked up a swoRd"
def test_look_object_not_equipped_amulet():
    game = Game()
    game.load("games/LookTest.xml")
    game.pickup("amulet")
    game.equip("amulet")
    assert game.look_at("amulet") == "Pretty amulet"