def test_eat(self): hero=People('haha',job='fashi',hp=30,mp=50) xue=Drug(50,0) lan=Drug(0,60) hero.eat(xue) self.assertEqual(hero.hp,80) hero.eat(lan) self.assertEqual(hero.mp,100)
def test_attack(self): hero=People('haha',job='fashi',) monster=Monster('xiaochou',) skill1=Skill(0,'fashi',5) fazhang=Equipment(0,'fashi',7,0) hero.learn(skill1) hero.equip(fazhang) self.assertEqual(hero.attk,22) hero.attack(monster)
def test_lv_up(self): hero=People('haha',job='fashi',level=1,exp=10) hero.lv_up() self.assertEqual(hero.level,2) self.assertEqual(hero.exp,0) self.assertEqual(hero.attk,20)
def test_people(self): hero=People('haha',job='zhanshi') self.assertFalse(hero.is_dead()) self.assertEqual(hero.hp,100)
def test_skill(self): hero=People('haha',job='zhanshi',level=2) skill1=Skill(3,'fashi',5) x=hero.learn(skill1) self.assertFalse(x) self.assertEqual(hero.attk,10)
def test_equipment(self): hero=People('haha',job='fashi',level=3) fazhang=Equipment(require_lv=3,job='fashi',attk=5,deff=0) x=hero.equip(fazhang) self.assertTrue(x) self.assertEqual(hero.attk,15)