Пример #1
0
    def setUp(self):
        self.txt = '''
가나다(2082652342) (03.11 오후 02:33)

2082652342 가나다  https://github.com/CPF18B/18pfb_lpthw-jkl

라마바(2018007194) (03.11 오후 02:33)

2018007194 라마바 https://github.com/CPF18A/18pfa_lpthw-def.git

사아자(2017958076) (03.11 오후 02:33)

2017958076 사아자 https://[email protected]/CPF18A/18pfa_lpthw-ghi

가나다(2082652342) (03.11 오후 02:33)

2082652342 가나다  https://github.com/CPF 18B/18pfb_lpthw-jkl
'''

        self.expected_url_list = [
            "https://github.com/CPF18B/18pfb_lpthw-jkl",
            "https://github.com/CPF18A/18pfa_lpthw-def.git",
            "https://[email protected]/CPF18A/18pfa_lpthw-ghi",
        ]

        self.input_file = tempf.write_to_temp_file(self.txt)
Пример #2
0
    def test_get_argn_from_sys_import_argv_no_inline_comment(self):
        argv_file = tempf.write_to_temp_file("# comment a\n"
                                             "# comment b\n"
                                             "# commnet c\n"
                                             "\n"
                                             "from sys import argv\n"
                                             "\n"
                                             "a, b, c = argv\n"
                                             "\n"
                                             "print('a =', a)\n"
                                             "print('b =', b)\n"
                                             "print('c =', c)\n"
                                             "\n")

        result = eval_repo.get_argn(argv_file.name)

        os.remove(argv_file.name)

        expected = 3

        self.assertEqual(expected, result)
Пример #3
0
    def test_get_argn_from_sys_import_argv_with_equal_in_inline_comment(self):
        argv_file = tempf.write_to_temp_file(
            "# comment a\n"
            "# comment b\n"
            "# commnet c\n"
            "\n"
            "from sys import argv\n"
            "\n"
            "스크립트, 파일_이름 = argv #argv = 실행할때 사용자에게 입력 받음, 파일 이름은 경로까지!\n"
            "\n"
            "print('a =', a)\n"
            "print('b =', b)\n"
            "print('c =', c)\n"
            "\n")

        result = eval_repo.get_argn(argv_file.name)

        os.remove(argv_file.name)

        expected = 2

        self.assertEqual(expected, result)
Пример #4
0
    def test_get_argn_import_sys_with_inline_comment_trailing_comma(self):
        argv_file = tempf.write_to_temp_file(
            "# comment a\n"
            "# comment b\n"
            "# commnet c\n"
            "\n"
            "import sys\n"
            "\n"
            "a, b, c, = sys.argv # inline comment\n"
            "\n"
            "print('a =', a)\n"
            "print('b =', b)\n"
            "print('c =', c)\n"
            "\n")

        result = eval_repo.get_argn(argv_file.name)

        os.remove(argv_file.name)

        expected = 3

        self.assertEqual(expected, result)
Пример #5
0
    def test_get_argn_import_sys_comment(self):

        argv_file = tempf.write_to_temp_file("# comment a\n"
                                             "# comment b\n"
                                             "# commnet c\n"
                                             "\n"
                                             "import sys\n"
                                             "\n"
                                             "# a, b, c = sys.argv # comment\n"
                                             "a, b, c = 1, 2, 3 # comment\n"
                                             "\n"
                                             "print('a =', a)\n"
                                             "print('b =', b)\n"
                                             "print('c =', c)\n"
                                             "\n")

        result = eval_repo.get_argn(argv_file.name)

        os.remove(argv_file.name)

        expected = 0

        self.assertEqual(expected, result)