示例#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 caut_stud(self):
        student = Student(1, "Andrei")
        repo = Repo()

        repo.adauga(student)
        cheie = Student(2, None)

        try:
            repo.cauta(cheie)
            assert False
        except RepoError as re:
            assert str(re) == "item inexistent"
        cheie = Student(1, None)
        gasit = repo.cauta(cheie)
        assert gasit.get_id() == 1
        assert gasit.get_nume() == "Andrei"
示例#3
0
    def caut_disciplina(self):
        disciplina = Disciplina(25, "andrei", "romana")
        repo = Repo()

        repo.adauga(disciplina)
        cheie = Disciplina(23, "andrei", "romana")

        try:
            repo.cauta(cheie)
            assert False
        except RepoError as re:
            assert str(re) == "item inexistent"
        cheie = Disciplina(25, "andrei", "romana")
        gasit = repo.cauta(cheie)
        assert gasit.get_id() == 25
        assert gasit.get_nume() == "romana"
        assert gasit.get_materie() == "andrei"
示例#4
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