def test_dead_card_removed_from_field(self): c1 = CreatureCard() c2 = CreatureCard() #kill creatures c1.is_alive = False c2.is_alive = False self.game.player1_game_field[1] = c1 self.game.player2_game_field[2] = c2 self.game.remove_dead() self.assertEqual(self.game.player1_game_field[1], None) self.assertEqual(self.game.player2_game_field[2], None)
class TestCreatureCard(unittest.TestCase): def setUp(self): self.c_d10_h20 = CreatureCard(10,20) self.c_d5_h30 = CreatureCard(5, 30) def test_creature_damage_other(self): c1 = CreatureCard(10, 20) c2 = CreatureCard(10, 20) c1.attack(c2) self.assertEqual(c2.health,10) def test_creature_when_damage_other_damage_self(self): self.c_d10_h20.attack(self.c_d5_h30) self.assertEqual(self.c_d10_h20.health, 15) def test_creature_can_die_from_damage(self): c1 = CreatureCard(10, 10) c1.take_damage(20) self.assertFalse(c1.is_alive)
def setUp(self): self.c_d10_h20 = CreatureCard(10,20) self.c_d5_h30 = CreatureCard(5, 30)
def test_creature_can_die_from_damage(self): c1 = CreatureCard(10, 10) c1.take_damage(20) self.assertFalse(c1.is_alive)
def test_creature_damage_other(self): c1 = CreatureCard(10, 20) c2 = CreatureCard(10, 20) c1.attack(c2) self.assertEqual(c2.health,10)