Пример #1
0
 def test_change_prop_contest(self):
     sys.argv = ['please', 'create', 'contest', 'test', 'of', 'problem1', 'problem2']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
     sys.argv = ['please', 'change', 'contest', 'test', 'prop', 'name', 'AAA']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #2
0
 def test_stress_correct_with_args(self):
     sys.argv = [
         'please', 'stress', 'solutions/prev_ni.py', 'solutions/wrong.dpr',
         'gen2.dpr', 'with', 'args', '100'
     ]
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 1)
Пример #3
0
    def test_set_validator(self):
        sys.argv = ['please', 'set', 'validator', 'val.cpp']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'set', 'val', 'val.cpp']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)
Пример #4
0
    def test_set_validator(self):
        sys.argv = ['please', 'set', 'validator', 'val.cpp']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'set', 'val', 'val.cpp']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)
Пример #5
0
    def test_add_delete_solution(self):
        sys.argv = ['please', 'add', 'solution', 'solutions/wrong.dpr']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'delete', 'solution', 'solutions/wrong.dpr']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)
Пример #6
0
 def test_please_noargs(self):
     sys.argv = ['please']
     launcher.main()
     self.assertEqual(log.logger.info.call_args_list, [
         call(
             "Type 'please commands' to show all available commands or 'please help' to show them with detailed description"
         )
     ])
Пример #7
0
    def test_add_delete_solution(self):
        sys.argv = ['please', 'add', 'solution', 'solutions/wrong.dpr']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'delete', 'solution', 'solutions/wrong.dpr']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)
Пример #8
0
 def test_set_main_solution(self):
     sys.argv = [
         'please', 'set', 'main', 'solution', 'solutions/prev_ni.py'
     ]
     launcher.main()
     sys.argv = [
         'please', 'set', 'main', 'solution', 'solutions/prev_st.dpr'
     ]
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #9
0
 def test_change_prop_contest(self):
     sys.argv = [
         'please', 'create', 'contest', 'test', 'of', 'problem1', 'problem2'
     ]
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
     sys.argv = [
         'please', 'change', 'contest', 'test', 'prop', 'name', 'AAA'
     ]
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #10
0
    def test_add_delete_solution_verdicts(self):
        sys.argv = [
            'please', 'add', 'solution', 'solutions/wrong.dpr', 'expected',
            'WA', 'TL', 'possible', 'OK'
        ]
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        self.assertEqual(log.logger.error.call_count, 0)
        sys.argv = [
            'please', 'change', 'prop', 'solutions/wrong.dpr', 'expected',
            'WA', 'OK', 'possible', 'TL'
        ]
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        self.assertEqual(log.logger.error.call_count, 0)
        sys.argv = ['please', 'del', 'prop', 'solutions/wrong.dpr', 'expected']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        self.assertEqual(log.logger.error.call_count, 0)
        sys.argv = ['please', 'delete', 'solution', 'solutions/wrong.dpr']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)
Пример #11
0
    def test_add_delete_from_contest(self):
        sys.argv = ['please', 'create', 'contest', 'test', 'of', 'problem1', 'problem2']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'delete', 'problem', 'problem2', 'from', 'test']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'add', 'problem', 'problem2', 'to', 'test']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'del', 'problem', 'problem1', 'from', 'test']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'add', 'problems', 'problem1', 'to', 'test']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)
Пример #12
0
    def test_add_delete_from_contest(self):
        sys.argv = [
            'please', 'create', 'contest', 'test', 'of', 'problem1', 'problem2'
        ]
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'delete', 'problem', 'problem2', 'from', 'test']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'add', 'problem', 'problem2', 'to', 'test']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'del', 'problem', 'problem1', 'from', 'test']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'add', 'problems', 'problem1', 'to', 'test']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)
Пример #13
0
    def test_add_delete_solution_verdicts(self):
        sys.argv = ['please', 'add', 'solution', 'solutions/wrong.dpr', 'expected', 'WA', 'TL', 'possible', 'OK']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        self.assertEqual(log.logger.error.call_count, 0)
        sys.argv = ['please', 'change', 'prop', 'solutions/wrong.dpr', 'expected', 'WA', 'OK', 'possible', 'TL']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        self.assertEqual(log.logger.error.call_count, 0)
        sys.argv = ['please', 'del', 'prop', 'solutions/wrong.dpr', 'expected']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        self.assertEqual(log.logger.error.call_count, 0)
        sys.argv = ['please', 'delete', 'solution', 'solutions/wrong.dpr']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)
Пример #14
0
    def test_gen_contest_statements(self):
        sys.argv = ['please', 'create', 'contest', 'test', 'of', 'problem1', 'problem2']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'gen', 'contest', 'test', 'statements']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'generate', 'contest', 'test', 'pdf']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        shutil.rmtree('.statements')
        os.remove('test.pdf')
Пример #15
0
    def test_gen_contest_statements(self):
        sys.argv = [
            'please', 'create', 'contest', 'test', 'of', 'problem1', 'problem2'
        ]
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'gen', 'contest', 'test', 'statements']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'generate', 'contest', 'test', 'pdf']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        shutil.rmtree('.statements')
        os.remove('test.pdf')
Пример #16
0
 def test_gen_pdf(self):
     sys.argv = ['please', 'gen', 'pdf']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #17
0
 def test_add_tags(self):
     sys.argv = ['please', 'add', 'tags', 'tag1', 'tag2', 'tag3']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #18
0
 def test_todo(self):
     sys.argv = ['please', 'todo']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #19
0
 def test_todo(self):
     sys.argv = ['please', 'todo']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #20
0
 def test_gen_ans(self):
     sys.argv = ['please', 'generate', 'answers']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #21
0
 def test_build_all(self):
     sys.argv = ['please', 'build', 'all']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #22
0
    def test_solutions(self):
        sys.argv = ['please', 'check', 'solution']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'run', 'sols']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'check', 'all']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'run', 'all', 'sols']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'check', 'all', 'solutions']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'check', 'sol', 'prev_ni.py']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'check', 'sol', 'ni']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'run', 'solution', 'solutions/prev_st.dpr']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'check', 'main', 'solution']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'run', 'main', 'sol']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'check', 'main']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)
Пример #23
0
 def test_problem_config_set(self):
     sys.argv = ['please', 'set', 'name', 'aaa']
     launcher.main()
     sys.argv = ['please', 'set', 'problem', 'name', 'b24']
     launcher.main()
     sys.argv = ['please', 'set', 'input', 'stdin']
     launcher.main()
     sys.argv = ['please', 'set', 'input', 'prev.in']
     launcher.main()
     sys.argv = ['please', 'set', 'output', 'stdout']
     launcher.main()
     sys.argv = ['please', 'set', 'output', 'prev.out']
     launcher.main()
     sys.argv = ['please', 'set', 'time_limit', '2.1']
     launcher.main()
     sys.argv = ['please', 'set', 'ML', '128']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #24
0
 def test_please_blablabla(self):
     sys.argv = ['please', 'blablabla']
     launcher.main()
     self.assertEqual([call('Please error: No functions match the template entered')], log.logger.error.call_args_list)
Пример #25
0
 def test_zip(self):
     sys.argv = ['please', 'zip']
     launcher.main()
     os.remove('package.zip')
     self.assertEqual(log.logger.error.call_count, 0)
Пример #26
0
 def test_problem_config_set(self):
     sys.argv = ['please', 'set', 'name', 'aaa']
     launcher.main()
     sys.argv = ['please', 'set', 'problem', 'name', 'b24']
     launcher.main()
     sys.argv = ['please', 'set', 'input', 'stdin']
     launcher.main()
     sys.argv = ['please', 'set', 'input', 'prev.in']
     launcher.main()
     sys.argv = ['please', 'set', 'output', 'stdout']
     launcher.main()
     sys.argv = ['please', 'set', 'output', 'prev.out']
     launcher.main()
     sys.argv = ['please', 'set', 'time_limit', '2.1']
     launcher.main()
     sys.argv = ['please', 'set', 'ML', '128']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #27
0
 def test_set_std_checker_name(self):
     sys.argv = ['please', 'set', 'std', 'checker', 'fcmp']
     launcher.main()
     sys.argv = ['please', 'set', 'checker', 'check.cpp']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #28
0
 def test_set_standart_checker(self):
     sys.argv = ['please', 'set', 'standart', 'checker']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #29
0
 def test_please_blablabla(self):
     sys.argv = ['please', 'blablabla']
     launcher.main()
     self.assertEqual(
         [call('Please error: No functions match the template entered')],
         log.logger.error.call_args_list)
Пример #30
0
 def test_please_noargs(self):
     sys.argv = ['please']
     launcher.main()
     self.assertEqual(log.logger.info.call_args_list, [call("Type 'please commands' to show all available commands or 'please help' to show them with detailed description")])
Пример #31
0
 def test_set_standart_checker(self):
     sys.argv = ['please', 'set', 'standart', 'checker']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #32
0
 def test_set_main_solution(self):
     sys.argv = ['please', 'set', 'main', 'solution', 'solutions/prev_ni.py']
     launcher.main()
     sys.argv = ['please', 'set', 'main', 'solution', 'solutions/prev_st.dpr']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #33
0
    def test_solutions(self):
        sys.argv = ['please', 'check', 'solution']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'run', 'sols']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'check', 'all']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'run', 'all', 'sols']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'check', 'all', 'solutions']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'check', 'sol', 'prev_ni.py']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'check', 'sol', 'ni']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'run', 'solution', 'solutions/prev_st.dpr']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'check', 'main', 'solution']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'run', 'main', 'sol']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)

        sys.argv = ['please', 'check', 'main']
        launcher.main()
        self.assertEqual(log.logger.error.call_count, 0)
Пример #34
0
 def test_add_tags(self):
     sys.argv = ['please', 'add', 'tags', 'tag1', 'tag2', 'tag3']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #35
0
 def test_clean(self):
     sys.argv = ['please', 'build']
     launcher.main()
     sys.argv = ['please', 'clean']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #36
0
 def test_clear_tags(self):
     sys.argv = ['please', 'clear', 'tags']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #37
0
 def test_compute_integer_timelimit(self):
     sys.argv = ['please', 'compute', 'integer', 'timelimit']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #38
0
 def test_please_commands(self):
     sys.argv = ['please', 'commands']
     launcher.main()
     self.assertEqual(log.logger.error.call_args_list, [])
Пример #39
0
 def test_validate(self):
     sys.argv = ['please', 'validate']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #40
0
 def test_stress_correct_with_args(self):
     sys.argv = ['please', 'stress',  'solutions/prev_ni.py', 'solutions/wrong.dpr', 'gen2.dpr', 'with', 'args', '100']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 1)
Пример #41
0
 def test_stress(self):
     sys.argv = ['please', 'stress', 'solutions/wrong.dpr', 'gen2.dpr']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 1)
Пример #42
0
#!/usr/bin/python3

if __name__ == "__main__":
    from please.launcher import main  # avoiding unnecessary imports
    main()
Пример #43
0
 def test_clear_tags(self):
     sys.argv = ['please', 'clear', 'tags']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #44
0
 def test_stress(self):
     sys.argv = ['please', 'stress',  'solutions/wrong.dpr', 'gen2.dpr']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 1)
Пример #45
0
 def test_compute_tl(self):
     sys.argv = ['please', 'compute', 'tl']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #46
0
 def test_validate(self):
     sys.argv = ['please', 'validate']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #47
0
 def test_compute_integer_timelimit(self):
     sys.argv = ['please', 'compute', 'integer', 'timelimit']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #48
0
 def test_build_all(self):
     sys.argv = ['please', 'build', 'all']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #49
0
 def test_set_std_checker_name(self):
     sys.argv = ['please', 'set', 'std', 'checker', 'fcmp']
     launcher.main()
     sys.argv = ['please', 'set', 'checker', 'check.cpp']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #50
0
 def test_clean(self):
     sys.argv = ['please', 'build']
     launcher.main()
     sys.argv = ['please', 'clean']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #51
0
 def test_zip(self):
     sys.argv = ['please', 'zip']
     launcher.main()
     os.remove('package.zip')
     self.assertEqual(log.logger.error.call_count, 0)
Пример #52
0
 def test_generate_tests_with_tags(self):
     sys.argv = ['please', 'generate', 'tests', 'with', 'tag', 'sample']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #53
0
 def test_generate_statements(self):
     sys.argv = ['please', 'generate', 'statements']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #54
0
 def test_gen_ans(self):
     sys.argv = ['please', 'generate', 'answers']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #55
0
 def test_generate_tests_with_tags(self):
     sys.argv = ['please', 'generate', 'tests', 'with', 'tag', 'sample']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #56
0
 def test_generate_statements(self):
     sys.argv = ['please', 'generate', 'statements']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #57
0
 def test_please_commands(self):
     sys.argv = ['please', 'commands']
     launcher.main()
     self.assertEqual(log.logger.error.call_args_list, [])
Пример #58
0
 def test_gen_pdf(self):
     sys.argv = ['please', 'gen', 'pdf']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)
Пример #59
0
#!/usr/bin/python3

if __name__ == "__main__":
    from please.launcher import main  # avoiding unnecessary imports

    main()
Пример #60
0
 def test_compute_tl(self):
     sys.argv = ['please', 'compute', 'tl']
     launcher.main()
     self.assertEqual(log.logger.error.call_count, 0)