Ejemplo n.º 1
0
def testItemConsumed():
    swordItem = ItemFactory(ItemList.Sword)
    numberOfUsesInCreationTime = swordItem.getRemainingUses()
    for _ in range(numberOfUsesInCreationTime):
        assert swordItem.isconsumed() == False
        swordItem.useItem()
    assert swordItem.isconsumed() == True
Ejemplo n.º 2
0
def testItemUsed():
    potionItem = ItemFactory(ItemList.Potion)
    numberOfUsesInCreationTime = potionItem.getRemainingUses()
    potionItem.useItem()
    assert potionItem.isUsed() == True
    assert potionItem.getRemainingUses() == numberOfUsesInCreationTime - 1
    sleep(2)
    assert potionItem.getTimeRemaining() < 148
Ejemplo n.º 3
0
def testCoin():
    smallCoin = ItemFactory(ItemList.Coin)
    assert smallCoin.getRemainingUses() == 1
    smallCoin.useItem()
    assert smallCoin.isconsumed() == True