예제 #1
0
    def test_hero_validation_raises_typeerror_if_title_not_str(self):
        name = 'Bron'
        title = ['Dragonslayer']
        mana_regeneration_rate = 2

        with self.assertRaisesRegex(TypeError, 'Title must be of "str" type.'):
            Hero.validate_input_hero(name, title, mana_regeneration_rate)
예제 #2
0
    def test_hero_validation_raises_typeerror_if_mana_regen_rate_not_int(self):
        name = 'Bron'
        title = 'Dragonslayer'
        mana_regeneration_rate = 'p'

        with self.assertRaisesRegex(
                TypeError, 'Mana regeneration rate must be of "int" type.'):
            Hero.validate_input_hero(name, title, mana_regeneration_rate)
예제 #3
0
    def test_hero_validation_raises_exception_if_mana_regen_rate_negative(
            self):
        name = 'Bron'
        title = 'Dragonslayer'
        mana_regeneration_rate = -5

        with self.assertRaisesRegex(
                ValueError, 'Mana regeneration rate cannot be negative.'):
            Hero.validate_input_hero(name, title, mana_regeneration_rate)