def test_wild_shapes(self):
     char = Druid()
     # Druid level 2
     char.level = 2
     # Set reasonable wild shapes
     char.wild_shapes = ['Wolf']
     self.assertIsInstance(char.wild_shapes[0], monsters.Wolf)
     # Check what happens if a non-existent wild_shape is added
     with self.assertRaises(exceptions.MonsterError):
         char.wild_shapes = ['Wolf', 'Hyperion Loader']
     # Check what happens if a valid monster class is directly added
     char.wild_shapes = [monsters.Wolf(), ]
     self.assertIsInstance(char.wild_shapes[0], monsters.Wolf)
     # Check that invalid monsters aren't accepted
     char.wild_shapes = ['Wolf', 'giant eagle']
     self.assertEqual(len(char.wild_shapes), 1)
     self.assertIsInstance(char.wild_shapes[0], monsters.Wolf)
Example #2
0
 def test_ability_scores(self):
     wolf = monsters.Wolf()
     self.assertEqual(wolf.strength.value, 12)
     self.assertEqual(wolf.strength.modifier, 1)
     self.assertEqual(wolf.strength.saving_throw, 1)