def test_get_first_two_friendly_mechs_that_died(self): non_mech = create_entity('Brann Bronzebeard') mech_1 = create_entity('Mechano-Egg') mech_2 = create_entity('Mechano-Egg') mech_3 = create_entity('Mechano-Egg') still_alive = create_entity() combat = SimulatedCombat( ([non_mech, mech_1, still_alive, mech_2, mech_3], [])) combat.handle_entity_death(non_mech) combat.handle_entity_death(mech_1) combat.handle_entity_death(mech_2) combat.handle_entity_death(mech_3) self.assertEqual( combat.get_first_two_friendly_mechs_that_died(still_alive), [mech_1, mech_2])
def test_handle_entity_death_trigger_deathrattle(self, trigger): minion = create_entity(deathrattle=True) combat = SimulatedCombat(([minion], [])) combat.handle_entity_death(minion) trigger.assert_any_call(minion, Event.DEATHRATTLE) trigger.reset_mock() combat.controllers[0].append(create_entity('Baron Rivendare')) combat.handle_entity_death(minion) trigger.assert_has_calls( (unittest.mock.call(minion, Event.DEATHRATTLE), unittest.mock.call(minion, Event.DEATHRATTLE))) trigger.reset_mock() del combat.controllers[0][-1] combat.controllers[0].append( create_entity('Baron Rivendare', triple=True)) combat.handle_entity_death(minion) trigger.assert_has_calls( (unittest.mock.call(minion, Event.DEATHRATTLE), unittest.mock.call(minion, Event.DEATHRATTLE), unittest.mock.call(minion, Event.DEATHRATTLE)))