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