示例#1
0
    def test_this_shit(self):
        run1 = Mock()
        run1.case_id = 1
        run1.outcome = 'OK'
        run1.time = 3000

        run2 = Mock()
        run2.case_id = 2
        run2.outcome = 'OK'
        run2.time = 3500

        run3 = Mock()
        run3.case_id = 3
        run3.outcome = 'OK'
        run3.time = 2700

        submit = Mock()
        submit.runs = [run1, run2, run3]

        for i in range(10):
            submit.problem_id = i
            self.srf.visit(submit)
            self.srf.visit(submit)

        run4 = Mock()
        run4.case_id = 1
        run4.outcome = 'OK'
        run4.time = 3000

        run5 = Mock()
        run5.case_id = 2
        run5.outcome = 'WA'
        run5.time = 3000

        submit1 = Mock()
        submit1.runs = [run4, run5]
        self.srf.visit(submit1)

        self.assertEqual(self.srf.pretty_print(),
                         'WE RECOMMEND REMOVING: 20/32 (62%)\nIT WILL SAVE: 0D 0H 2M 10S / 0D 0H 3M 10S (68%)\n')
示例#2
0
    def test_ACM_(self):
        run1 = Mock()
        run1.case_id = 1
        run1.outcome = 'OK'
        run1.time = 3000

        run2 = Mock()
        run2.case_id = 2
        run2.outcome = 'OK'
        run2.time = 3500

        run3 = Mock()
        run3.case_id = 3
        run3.outcome = 'OK'
        run3.time = 2700

        submit = Mock()
        submit.runs = [run1, run2, run3]

        self.same.visit(submit)
        self.assertEqual(self.same.pretty_print(), 'Submits - 1\nEquivalent tests: {1 2 3}\n'
                                                   'we recommend removing: 2/3 (66%) {1 2}\nit will save: 6sec/9sec (70%)\n')