コード例 #1
0
 def modifica_student(self):
     student = Student(25, "laris")
     repo_stud = Repo()
     repo_stud.adauga(student)
     nume_change = "Andrei"
     cheie_stud = Student(24, None)
     try:
         repo_stud.cauta(cheie_stud)
         assert False
     except RepoError as re:
         assert str(re) == "item inexistent"
     cheie_stud = Student(25, None)
     stud_gasit = repo_stud.cauta(cheie_stud)
     repo_stud.modifica(stud_gasit, nume_change)
     assert repo_stud.cauta(stud_gasit).get_nume() == nume_change
コード例 #2
0
 def modifica_disciplina(self):
     disciplina = Disciplina(25, "mate", "ladla")
     repo = Repo()
     repo.adauga(disciplina)
     nume_change = "Andrei"
     materie_change = "info"
     cheie_disciplina = Disciplina(24, None, None)
     try:
         repo.cauta(cheie_disciplina)
         assert False
     except RepoError as re:
         assert str(re) == "item inexistent"
     cheie_disciplina = Disciplina(25, None, None)
     disciplina_gasita = repo.cauta(cheie_disciplina)
     repo.modifica(disciplina_gasita, nume_change)
     repo.modifica_materie(disciplina_gasita, materie_change)
     assert repo.cauta(disciplina_gasita).get_nume() == nume_change
     assert repo.cauta(disciplina_gasita).get_materie() == materie_change