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