def testItemConsumed(): swordItem = ItemFactory(ItemList.Sword) numberOfUsesInCreationTime = swordItem.getRemainingUses() for _ in range(numberOfUsesInCreationTime): assert swordItem.isconsumed() == False swordItem.useItem() assert swordItem.isconsumed() == True
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
def testCoin(): smallCoin = ItemFactory(ItemList.Coin) assert smallCoin.getRemainingUses() == 1 smallCoin.useItem() assert smallCoin.isconsumed() == True