Esempio n. 1
0
    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"
Esempio n. 2
0
def main():
    model = Annotator.load()
    ctrl = AnnotatorController()
    view = AnnotatorView()

    model.add_view(view)
    ctrl.model = model
    view.ctrl = ctrl

    view.annotator_view()
Esempio n. 3
0
    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"
Esempio n. 4
0
def step_impl(context, mid):
    model = Annotator.create()
    ctrl = AnnotatorController()
    ctrl.model = model
    context.ctrl = ctrl
    context.model = model
    team_home = Team('Dallas')
    team_away = Team('NewYork')
    match = Match(team_home, team_away)
    ctrl.add_match(match)
    ctrl.get_match(str(mid)).start_match()
    if context.play_team == 'home':
        team = team_home
    else:
        team = team_away
    play = Play(ptype=context.play_type, spec=context.play_spec, team=team,
                descrip=context.play_desc, time=context.play_min)
    ctrl.get_match(str(mid)).add_play(play)
Esempio n. 5
0
def step_impl(context):
    context.model = None
    context.model = Annotator.load()
    assert isinstance(context.model, Annotator)
Esempio n. 6
0
def step_impl(context):
    model = Annotator.create()
    ctrl = AnnotatorController()
    ctrl.model = model
    context.ctrl = ctrl
    context.model = model