def monster(): return monsters.Monster()
def test_monster_action(self): monster = monsters.Monster() action_result = monster.action() self.assertEqual('was roaring', action_result) self.assertEqual(1, monster.action_count)
def test_custom_hit_points(self): monster = monsters.Monster(hit_points=200) self.assertEqual(200, monster.hit_points)
def test_default(self): monster = monsters.Monster() self.assertEqual(20, monster.hit_points) self.assertEqual('roaring', monster.sound)
import unittest import pytest as pytest from ase_game_py_mod import monsters @pytest.mark.parametrize('monster, expected', [ (monsters.Monster(), 20), (monsters.Monster(hit_points=22), 22), ]) def test_default(monster, expected): # pragma for coverage? # inputs, why?, expected results """ Default Monster class should hva a 'roar' sound and 20 hit points :param monster: :return: """ assert monster.sound == 'roaring' assert monster.hit_points == expected def test_color(monster): assert monster.color == 'blue' def test_hitpoints(monster): assert monster.hit_points == 20 def test_battle_cry(monster):
#! python from ase_game_py_mod import monsters monster = monsters.Monster() var = monster.hit_points print(var)