def repo_adauga_student(self): student = Student(25, "laris") repo_stud = Repo() assert repo_stud.size() == 0 repo_stud.adauga(student) assert repo_stud.size() == 1 student = Student(25, "lala") try: repo_stud.adauga(student) assert False except RepoError as re: assert str(re) == "item deja existent!\n"
def test_adaug_nota(self): nota = Nota(1, 5, 7) repo = Repo() assert repo.size() == 0 repo.adauga(nota) assert repo.size() == 1 try: repo.adauga(nota) assert False except RepoError as re: assert str(re) == "item deja existent!\n"
def repo_delete_student(self): student = Student(25, "andrei") repo = Repo() repo.adauga(student) assert repo.size() == 1 cheie_student = Student(24, None) try: repo.delete(cheie_student) assert False except RepoError as re: assert str(re) == "item inexistent" cheie_student = Student(25, None) repo.delete(cheie_student) assert repo.size() == 0
def repo_delete_disciplina(self): disciplina = Disciplina(25, "andrei", "romana") repo = Repo() repo.adauga(disciplina) assert repo.size() == 1 cheie_disciplina = Disciplina(24, None, None) try: repo.delete(cheie_disciplina) assert False except RepoError as re: assert str(re) == "item inexistent" cheie_disciplina = Disciplina(25, None, None) repo.delete(cheie_disciplina) assert repo.size() == 0
def repo_adauga_disciplina(self): disciplina = Disciplina(1, "mate", "berinde") repo = Repo() assert repo.size() == 0 repo.adauga(disciplina) try: repo.adauga(disciplina) assert False except RepoError as re: assert str(re) == "item deja existent!\n"