예제 #1
0
 def visit(self, submit):
     if not self.child:
         if submit.scoring.upper() == 'ACM':
             self.child = SameRunsACM()
         else:
             self.child = ElectorByMaxCasesVisitor(ClassFactory(SameRunsKirov))
     self.child.visit(submit)
예제 #2
0
class SameRuns(Visitor):

    def __init__(self):
        self.child = None

    def visit(self, submit):
        if not self.child:
            if submit.scoring.upper() == 'ACM':
                self.child = SameRunsACM()
            else:
                self.child = ElectorByMaxCasesVisitor(ClassFactory(SameRunsKirov))
        self.child.visit(submit)

    def get_stat_data(self):
        return self.child.get_stat_data()

    def pretty_print(self):
        return self.child.pretty_print()
예제 #3
0
 def test_key(self):
     elector = ElectorByMaxCasesVisitor(None)
     submit = Mock()
     submit.runs = [1, 2, 3]
     self.assertEqual(elector.build_key(submit), 3)