예제 #1
0
 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"
예제 #2
0
    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"
예제 #3
0
    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
예제 #4
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
예제 #5
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"