Beispiel #1
0
 def test_if_enemy_deal_damage_alter_enemy_stats(self, mock_input, mock_choice):
     player = {"Health": [10, 10]}
     enemy_deal_damage(player, "James")
     expected_new_player_health_value = 7
     self.assertEqual(expected_new_player_health_value, player["Health"][1])
Beispiel #2
0
 def test_enemy_deal_damage_and_kill_enemy_return_value(self, mock_input, mock_choice):
     expected_output = "over"
     demon = {"Health": [5, 5]}
     actual_output = enemy_deal_damage(demon, "Demon")
     self.assertEqual(expected_output, actual_output)
Beispiel #3
0
 def test_enemy_deal_damage_and_kill_player_printed_output(self, mock_stdout, mock_input, mock_choice):
     demon = {"Health": [10, 5]}
     enemy_deal_damage(demon, "Demon")
     self.assertEqual(mock_stdout.getvalue(), "The Demon kills you.\n")
Beispiel #4
0
 def test_enemy_deal_damage_but_not_kill_return_value(self, mock_input, mock_choice):
     expected_output = "player retaliates"
     demon = {"Health": [10, 5]}
     actual_output = enemy_deal_damage(demon, "Demon")
     self.assertEqual(expected_output, actual_output)
Beispiel #5
0
 def test_enemy_deal_damage_but_not_kill_printed_output(self, mock_stdout, mock_input, mock_choice):
     player = {"Health": [10, 5]}
     enemy_deal_damage(player, "Demon")
     self.assertEqual(mock_stdout.getvalue(), "You lost 3 HP!!\nYou stumble back, dazed.\n")