def main(): model = Annotator.load() ctrl = AnnotatorController() view = AnnotatorView() model.add_view(view) ctrl.model = model view.ctrl = ctrl view.annotator_view()
def testOne(self): annotator = Annotator.create() msg = "Annotator creation fail." self.assertIsInstance(annotator, Annotator, msg) # 1.0 print "Annotator Test Set: 1.0 Success" home = Team(name='Barcelona') away = Team(name='Bayern Munich') match = Match(home=home, away=away) annotator.add_match(match) msg = "Annotator match addition fail." self.assertTrue(len(annotator.matches) > 0, msg) # 1.1 print "Annotator Test Set: 1.1 Success" annotator.remove_match(match) msg = "Annotator match deletion fail." self.assertTrue(len(annotator.matches) == 0, msg) # 1.2 print "Annotator Test Set: 1.2 Success" match_mid = match.mid annotator.add_match(match) match_copy = annotator.get_match(match_mid) msg = "Annotator get match fail." self.assertEquals(match_copy.mid, match_mid, msg) # 1.3 print "Annotator Test Set: 1.3 Success" annotator.save() annotator = None annotator = Annotator.load() msg = "Annotator persistance fail." self.assertIsInstance(annotator, Annotator, msg) # 1.4 print "Annotator Test Set: 1.4 Success" view = AnnotatorView() annotator.add_view(view) msg = "Annotator view addition fail." self.assertTrue(len(annotator.views) == 1, msg) # 1.5 print "Annotator Test Set: 1.5 Success" msg = "Annotator display information fail" self.assertTrue(annotator.display(), dict) # 2.0 print "Annotator Test Set: 2.0 Success"
def testOne(self): ctrl = AnnotatorController() msg = "AnnotatorController creation fail." self.assertIsInstance(ctrl, AnnotatorController, msg) # 1.0 print "AnnotatorController Test Set: 1.0 Success" model = Annotator.create() ctrl.model = model msg = "AnnotatorController model addition fail." self.assertEquals(ctrl.model, model) # 1.1 print "AnnotatorController Test Set: 1.1 Success" match = TestMatch(home='Barcelona', away='Bayern Munich', mid='BRAVSBAY15') ctrl.add_match(match) msg = "AnnotatorController match addition fail." self.assertEquals(model.get_match(match.mid), match) # 2.0 print "AnnotatorController Test Set: 2.0 Success" match_copy = ctrl.get_match(match.mid) msg = "AnnotatorController get match fail." self.assertEquals(match_copy, match, msg) # 2.1 print "AnnotatorController Test Set: 2.1 Success" ctrl.remove_match(match.mid) msg = "AnnotatorController match deletion fail." self.assertTrue(len(model.matches) == 0, msg) # 2.2 print "AnnotatorController Test Set: 2.2 Success" ctrl.save() model = None model = Annotator.load() msg = "AnnotatorController save state fail." self.assertIsInstance(model, Annotator, msg) # 2.3 print "AnnotatorController Test Set: 2.3 Success"
def step_impl(context): context.model = None context.model = Annotator.load() assert isinstance(context.model, Annotator)