コード例 #1
0
    def testRepo(self):
        repo = Repository()
        assert repo.add(Student('1', 'Mihai Ionut', 10, 10)) == False
        assert repo.add(Student('2', 'Mihai Ionut', 10, 10)) == False
        assert repo.add(Student('3', 'Mihai Ionut', 10, 10)) == False

        repo.addBonus(Student('1', 'Mihai', 13, 9), 1)
        repo.addBonus(Student('2', 'Ionut', 5, 8), 1)
        for i in repo.getAll():
            if i.getID() == 1:
                assert i.getGrade() == 10
            if i.getID() == 2:
                assert i.getGrade() == 9

        assert len(repo.getAll()) == 10