Пример #1
0
 def test_score_v6(self):
     """Create a 'Psionic' skill, then test method ``score``."""
     skill = factories.SkillFactory(
         category=models.Skill.get_category_id('Psionic'))
     character_skill = factories.CharacterSkillFactory.create(skill=skill)
     self.assertEqual(character_skill.score(),
                      character_skill._psionic_skill_score())
Пример #2
0
 def test_score_v5(self):
     """Create a 'Physical (strength)' skill, then test method ``score``."""
     skill = factories.SkillFactory(
         category=models.Skill.get_category_id('Physical (strength)'))
     character_skill = factories.CharacterSkillFactory.create(skill=skill)
     self.assertEqual(
         character_skill.score(),
         character_skill._physical_skill_score(
             character_skill.character.strength))
Пример #3
0
 def test_score_v2(self):
     """Create a 'Mental (health)' skill, then test method ``score``."""
     skill = factories.SkillFactory(
         category=models.Skill.get_category_id('Mental (health)'))
     character_skill = factories.CharacterSkillFactory.create(skill=skill)
     self.assertEqual(
         character_skill.score(),
         character_skill._mental_skill_score(
             character_skill.character.health))
Пример #4
0
 def test_psionic_skill_score_v6(self):
     """Test method ``_psionic_skill_score``."""
     character_skill = factories.CharacterSkillFactory.create(
         points=4, skill=factories.SkillFactory(difficulty=4))
     self.assertEqual(
         character_skill._psionic_skill_score(),
         character_skill.character.intelligence \
             - character_skill.skill.difficulty \
             + (character_skill.points // 4) \
             + 2
     )
Пример #5
0
    def test_movement(self):
        """Test the ``movement`` method."""
        character = factories.CharacterFactory.create()
        character_movement = floor(character.speed()) \
            - character.encumbrance_penalty() \
            + character.bonus_movement

        # Without the running skill
        self.assertEqual(character.movement(), character_movement)

        # Create a "running" skill. Link it to the test character.
        char_skill = factories.CharacterSkillFactory(
            character=character, skill=factories.SkillFactory(name='RuNnInG'))
        character_movement = floor(character.speed() \
            + (char_skill.score() / 8)) \
            - character.encumbrance_penalty() \
            + character.bonus_movement

        # With the running skills
        self.assertEqual(character.movement(), character_movement)
Пример #6
0
 def test_score_v7(self):
     """Create an invalid skill, then test method ``score``."""
     skill = factories.SkillFactory(category=7)
     character_skill = factories.CharacterSkillFactory.create(skill=skill)
     self.assertRaises(ValueError, character_skill.score)