Test body snatch potion, fixes #34
This commit is contained in:
parent
c38f8cdc53
commit
f39113fd0b
|
@ -3,7 +3,7 @@
|
|||
|
||||
import unittest
|
||||
|
||||
from squirrelbattle.entities.items import Bomb, Heart, Item
|
||||
from squirrelbattle.entities.items import BodySnatchPotion, Bomb, Heart, Item
|
||||
from squirrelbattle.entities.monsters import Tiger, Hedgehog, Rabbit, TeddyBear
|
||||
from squirrelbattle.entities.player import Player
|
||||
from squirrelbattle.interfaces import Entity, Map
|
||||
|
@ -154,6 +154,24 @@ class TestEntities(unittest.TestCase):
|
|||
heart_state = item.save_state()
|
||||
self.assertEqual(heart_state["healing"], item.healing)
|
||||
|
||||
def test_body_snatch_potion(self) -> None:
|
||||
"""
|
||||
Test some random stuff with body snatch potions.
|
||||
"""
|
||||
item = BodySnatchPotion()
|
||||
self.map.add_entity(item)
|
||||
item.hold(self.player)
|
||||
|
||||
tiger = Tiger(y=42, x=42)
|
||||
self.map.add_entity(tiger)
|
||||
|
||||
# The player becomes a tiger, and the tiger becomes a squirrel
|
||||
item.use()
|
||||
self.assertEqual(self.player.name, "tiger")
|
||||
self.assertEqual(tiger.name, "player")
|
||||
self.assertEqual(self.player.y, 42)
|
||||
self.assertEqual(self.player.x, 42)
|
||||
|
||||
def test_players(self) -> None:
|
||||
"""
|
||||
Test some random stuff with players.
|
||||
|
|
Loading…
Reference in New Issue