示例#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)