Esempio n. 1
0
 def test_playercharacter_constitution_modifies_total_hitpoints(self):
     player = player_character.PlayerCharacter('Foo',
                                               hitpoints=5,
                                               constitution=13)
     assert player.total_hitpoints == 6
Esempio n. 2
0
 def test_playercharacter_constitution_modifier_negative(self):
     player = player_character.PlayerCharacter('Foo', constitution=8)
     assert player.get_ability_modifier(player.constitution) == -1
Esempio n. 3
0
 def test_playercharacter_constitution_modifies_hitpoints_not_less_than_one(
         self):
     player = player_character.PlayerCharacter('Foo',
                                               hitpoints=3,
                                               constitution=2)
     assert player.hitpoints == 1
Esempio n. 4
0
 def test_playercharacter_define_correct_constitution(self):
     player = player_character.PlayerCharacter('Foo', constitution=13)
     assert player.constitution == 13
Esempio n. 5
0
 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
Esempio n. 6
0
 def test_playercharacter_dexterity_modifies_armorclass(self):
     player = player_character.PlayerCharacter('Foo', dexterity=13)
     assert player.to_hit == 11
Esempio n. 7
0
 def test_playercharacter_define_default_constitution(self):
     player = player_character.PlayerCharacter('Foo')
     assert player.constitution == 10
Esempio n. 8
0
 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).'
Esempio n. 9
0
 def test_playercharacter_define_correct_dexterity(self):
     player = player_character.PlayerCharacter('Foo', dexterity=13)
     assert player.dexterity == 13
Esempio n. 10
0
 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).'
Esempio n. 11
0
 def test_playercharacter_define_default_dexterity(self):
     player = player_character.PlayerCharacter('Foo')
     assert player.dexterity == 10
Esempio n. 12
0
 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'"
Esempio n. 13
0
 def test_playercharacter_define_correct_strength(self):
     player = player_character.PlayerCharacter('Foo', strength=13)
     assert player.strength == 13
Esempio n. 14
0
 def test_playercharacter_define_default_strength(self):
     player = player_character.PlayerCharacter('Foo')
     assert player.strength == 10
Esempio n. 15
0
 def test_playercharacter_ability_modifier_negative_large(self):
     player = player_character.PlayerCharacter('Foo')
     assert player.get_ability_modifier(7) == -2
Esempio n. 16
0
 def test_playercharacter_ability_modifier_positive(self):
     player = player_character.PlayerCharacter('Foo')
     assert player.get_ability_modifier(12) == 1