def test_playercharacter_constitution_modifies_total_hitpoints(self): player = player_character.PlayerCharacter('Foo', hitpoints=5, constitution=13) assert player.total_hitpoints == 6
def test_playercharacter_constitution_modifier_negative(self): player = player_character.PlayerCharacter('Foo', constitution=8) assert player.get_ability_modifier(player.constitution) == -1
def test_playercharacter_constitution_modifies_hitpoints_not_less_than_one( self): player = player_character.PlayerCharacter('Foo', hitpoints=3, constitution=2) assert player.hitpoints == 1
def test_playercharacter_define_correct_constitution(self): player = player_character.PlayerCharacter('Foo', constitution=13) assert player.constitution == 13
def test_playercharacter_define_incorrect_constitution(self): with pytest.raises(ValueError) as exp: player_character.PlayerCharacter('Foo', constitution='thirteen') assert str(exp.value) == INVALID_ATTRIBUTE_WARNING
def test_playercharacter_dexterity_modifies_armorclass(self): player = player_character.PlayerCharacter('Foo', dexterity=13) assert player.to_hit == 11
def test_playercharacter_define_default_constitution(self): player = player_character.PlayerCharacter('Foo') assert player.constitution == 10
def test_playercharacter_armorclass_create_incorrect_name(self): with pytest.raises(ValueError) as exp: player_character.PlayerCharacter(7) assert str(exp.value) == 'Please provide a valid name (string).'
def test_playercharacter_define_correct_dexterity(self): player = player_character.PlayerCharacter('Foo', dexterity=13) assert player.dexterity == 13
def test_playercharacter_create_with_invalid_experience(self): with pytest.raises(ValueError) as exp: player_character.PlayerCharacter('Foo', experience='a') assert str( exp.value ) == 'Please provide a valid experience amount (integer).'
def test_playercharacter_define_default_dexterity(self): player = player_character.PlayerCharacter('Foo') assert player.dexterity == 10
def test_playercharacter_incorrect_no_parameters(self): with pytest.raises(TypeError) as exp: player_character.PlayerCharacter() assert str( exp.value ) == "__init__() missing 1 required positional argument: 'name'"
def test_playercharacter_define_correct_strength(self): player = player_character.PlayerCharacter('Foo', strength=13) assert player.strength == 13
def test_playercharacter_define_default_strength(self): player = player_character.PlayerCharacter('Foo') assert player.strength == 10
def test_playercharacter_ability_modifier_negative_large(self): player = player_character.PlayerCharacter('Foo') assert player.get_ability_modifier(7) == -2
def test_playercharacter_ability_modifier_positive(self): player = player_character.PlayerCharacter('Foo') assert player.get_ability_modifier(12) == 1