def test_get_competence(self): group = Group(self.staffs) group.set_member('TsaiSong', 'Major') group.set_member('GordonLi', 'Major') group.set_member('YanGao', 'Backup') self.assertEqual(0.9, group.get_competence('MSC')) self.assertEqual(0.8, group.get_competence('NGW')) self.assertEqual(0.6, group.get_role_competence('Major', 'NGW'))
def test_duplicate_staff(self): group = Group(self.staffs) group.set_member('TsaiSong', 'Major') group.set_member('GordonLi', 'Major') self.assertRaises(ValueError, lambda : group.set_member('TsaiSong', 'Backup'))
def __prepare_groups(self): groups = [] group0 = Group(None) group0.set_member('TsaiSong', 'Major') group0.set_member('GordonLi', 'Major') group0.set_member('TomZhou', 'Backup') groups.append(group0) group1 = Group(None) group1.set_member('KennyHuang', 'Major') group1.set_member('TomZhou', 'Major') group1.set_member('DavidNong', 'Backup') groups.append(group1) group2 = Group(None) group2.set_member('KennyHuang', 'Major') group2.set_member('Ryan', 'Major') group2.set_member('YanGao', 'Backup') groups.append(group2) group3 = Group(None) group3.set_member('TsaiSong', 'Major') group3.set_member('GordonLi', 'Major') group3.set_member('DavidNong', 'Backup') groups.append(group3) group4 = Group(None) group4.set_member('TsaiSong', 'Major') group4.set_member('DavidNong', 'Major') group4.set_member('GordonLi', 'Backup') groups.append(group4) return groups