def setUp(self): repo = StudentBase() undo = UndoController() self.ctrl = StudentController(repo, undo)
from Controller.StudentController import * from Controller.GradeController import * from Controller.UndoController import * from BaseFile.FileGradeBase import * from BaseFile.FileStudentBase import * from UI.UI import * import operator import collections gb=GradeBase() db=DisciplineBase() fgb=FileGradeBase() fsb=FileStudentBase() sb=StudentBase() db.add(Discipline("FPcurs")) db.add(Discipline("FPlab")) db.add(Discipline("FPseminar")) db.add(Discipline("Logica")) db.add(Discipline("ASC")) db.add(Discipline("Algebra")) db.add(Discipline("Analiza")) a=input("Press 1 for nonfile or 2 for file.") if int(a)==2: undoCtrl=UndoController() sc=StudentController(fsb,undoCtrl) gc=GradeController(fgb,undoCtrl) dc=DisciplineController(db) sts=StatisticsController(gc,sc,dc)
from Base.StudentBase import * from Controller.DisciplineController import * from Controller.StudentController import * from Controller.GradeController import * from Controller.UndoController import * from BaseFile.FileGradeBase import * from BaseFile.FileStudentBase import * from UI.UI import * import operator import collections gb = GradeBase() db = DisciplineBase() fgb = FileGradeBase() fsb = FileStudentBase() sb = StudentBase() db.add(Discipline("FPcurs")) db.add(Discipline("FPlab")) db.add(Discipline("FPseminar")) db.add(Discipline("Logica")) db.add(Discipline("ASC")) db.add(Discipline("Algebra")) db.add(Discipline("Analiza")) a = input("Press 1 for nonfile or 2 for file.") if int(a) == 2: undoCtrl = UndoController() sc = StudentController(fsb, undoCtrl) gc = GradeController(fgb, undoCtrl) dc = DisciplineController(db) sts = StatisticsController(gc, sc, dc)
class Test(unittest.TestCase): def setUp(self): self.studentbase=StudentBase() s1=Student(1,'Chris') self.studentbase.add(s1) s2=Student(2,'test') self.studentbase.add(s2) def testAdd(self): s3=Student(3,"qwer") s4=Student(3,'rtrewe') self.studentbase.add(s3) self.assertEqual(len(self.studentbase),3) self.assertRaises(StudentException,self.studentbase.add,s4) def testDelete(self): self.studentbase.remove(2) self.assertEqual(len(self.studentbase), 1) self.assertRaises(StudentException,self.studentbase.remove,24) def testUpdate(self): #id grade teacher discipline self.studentbase.update(1, 'chris2') c=self.studentbase.findById(1) self.assertEqual(c.getName(), 'chris2') def testFindById(self): c1=Student(1,'Chris') c2=self.studentbase.findById(1) self.assertEqual(c1.getId(), c2.getId()) self.assertEqual(c1.getName(), c2.getName())
def setUp(self): self.studentbase=StudentBase() s1=Student(1,'Chris') self.studentbase.add(s1) s2=Student(2,'test') self.studentbase.add(s2)
def setUp(self): self.studentbase = StudentBase() s1 = Student(1, 'Chris') self.studentbase.add(s1) s2 = Student(2, 'test') self.studentbase.add(s2)
class Test(unittest.TestCase): def setUp(self): self.studentbase = StudentBase() s1 = Student(1, 'Chris') self.studentbase.add(s1) s2 = Student(2, 'test') self.studentbase.add(s2) def testAdd(self): s3 = Student(3, "qwer") s4 = Student(3, 'rtrewe') self.studentbase.add(s3) self.assertEqual(len(self.studentbase), 3) self.assertRaises(StudentException, self.studentbase.add, s4) def testDelete(self): self.studentbase.remove(2) self.assertEqual(len(self.studentbase), 1) self.assertRaises(StudentException, self.studentbase.remove, 24) def testUpdate(self): #id grade teacher discipline self.studentbase.update(1, 'chris2') c = self.studentbase.findById(1) self.assertEqual(c.getName(), 'chris2') def testFindById(self): c1 = Student(1, 'Chris') c2 = self.studentbase.findById(1) self.assertEqual(c1.getId(), c2.getId()) self.assertEqual(c1.getName(), c2.getName())