def TestGetNumeStudent(self): ''' Testeaza functia de obtinere a unui nume a unui student ''' assert (Student.GetNumeStudent(Student( 5, 'Tofan Paul-Adrian')) == 'Tofan Paul-Adrian') assert (Student.GetNumeStudent(Student( 5, 'Trifescu Stefan')) == 'Trifescu Stefan')
def TestSetNumeStudent(self): ''' Testeaza functia de setare a unui nume a unui student ''' stud = Student(12, 'Asd') Student.SetNumeStudent(stud, 'Adi') assert Student.GetNumeStudent(stud) == 'Adi'
def TestInit(self): ''' Testeaza functia de initializare a unui student ''' studNou = Student(1, 'Tofan Paul-Adrian') assert studNou.GetIdStudent() == 1 assert studNou.GetNumeStudent() == 'Tofan Paul-Adrian'
def ValidareStudent(self, stud): ''' Valideaza un student ''' erori = '' if self.__validator.ValidareId(Student.GetIdStudent(stud)) == False: erori += 'Id-ul introdus nu este valid.' if self.__validator.ValidareNume( Student.GetNumeStudent(stud)) == False: erori += 'Numele introdus nu este valid.' if len(erori) > 0: raise ValidationStudentException(erori)
def __uiPrintNoteStudentiDisciplinaAlfabetic(self): ''' Afiseaza notele tuturor studentilor la o anumita disciplina ordonati in ordine alfabetica ''' idd = input('Id-ul disciplinei: ') try: self.__validatorDisciplina.ValidareDisciplina( Disciplina(idd, 'asd', 'asd')) listStudenti = self.__StudServ.getStudenti() listNoteStudenti = self.__NotaServ.GetNoteStudDiscAlfabetic( idd, listStudenti) n = len(listNoteStudenti) listStudAlfabetic = sorted( listStudenti, key=lambda Student: Student.GetNumeStudent()) for stud in range(n): noteStud = '' for nota in listNoteStudenti[stud]: noteStud += str(nota) noteStud += ' ' print(listStudAlfabetic[stud], ': ', noteStud) except ValidationDisciplinaException as ve: print(ve)