예제 #1
0
 def test_rel_result_should_not_be_available_pre_act_phase(self):
     arguments = path_syntax.REL_RESULT_OPTION
     with self.assertRaises(SingleInstructionInvalidArgumentException):
         parser = sut.EmbryoParser(is_after_act_phase=False)
         # ACT #
         parser.parse(ARBITRARY_FS_LOCATION_INFO,
                      remaining_source(arguments))
예제 #2
0
 def test_fail_when_no_arguments(self):
     for is_after_act_phase in [False, True]:
         with self.subTest(is_after_act_phase=is_after_act_phase):
             arguments = ''
             parser = sut.EmbryoParser(
                 is_after_act_phase=is_after_act_phase)
             # ACT & ASSERT #
             with self.assertRaises(
                     SingleInstructionInvalidArgumentException):
                 parser.parse(ARBITRARY_FS_LOCATION_INFO,
                              remaining_source(arguments))
예제 #3
0
 def test_rel_tmp_with_superfluous_argument(self):
     arguments = format_rel_options('{rel_tmp} subdir superfluous')
     for is_after_act_phase in [False, True]:
         with self.subTest(is_after_act_phase=is_after_act_phase):
             with self.assertRaises(
                     SingleInstructionInvalidArgumentException):
                 parser = sut.EmbryoParser(
                     is_after_act_phase=is_after_act_phase)
                 # ACT #
                 parser.parse(ARBITRARY_FS_LOCATION_INFO,
                              remaining_source(arguments))
예제 #4
0
 def test_no_relativity_option_should_use_default_option(self):
     for is_after_act_phase in [False, True]:
         with self.subTest(is_after_act_phase=is_after_act_phase):
             arguments = 'single-argument'
             parser = sut.EmbryoParser(
                 is_after_act_phase=is_after_act_phase)
             # ACT #
             actual = parser.parse(ARBITRARY_FS_LOCATION_INFO,
                                   remaining_source(arguments))
             # ASSERT #
             expected_path = path_ddvs.of_rel_option(
                 RelOptionType.REL_CWD,
                 path_ddvs.constant_path_part(arguments))
             assertion = matches_path_sdv(expected_path, asrt.is_empty)
             assertion.apply_without_message(self, actual.destination)
예제 #5
0
 def test_rel_tmp_with_argument(self):
     for is_after_act_phase in [False, True]:
         with self.subTest(is_after_act_phase=is_after_act_phase):
             arguments = format_rel_options('{rel_tmp} subdir')
             parser = sut.EmbryoParser(
                 is_after_act_phase=is_after_act_phase)
             # ACT #
             actual = parser.parse(ARBITRARY_FS_LOCATION_INFO,
                                   remaining_source(arguments))
             # ASSERT #
             expected_path = path_ddvs.of_rel_option(
                 RelOptionType.REL_TMP,
                 path_ddvs.constant_path_part('subdir'))
             assertion = matches_path_sdv(expected_path, asrt.is_empty)
             assertion.apply_without_message(self, actual.destination)
예제 #6
0
 def test_success_when_correct_number_of_arguments__escaped(self):
     for is_after_act_phase in [False, True]:
         with self.subTest(is_after_act_phase=is_after_act_phase):
             arguments = '"expected argument"'
             parser = sut.EmbryoParser(
                 is_after_act_phase=is_after_act_phase)
             # ACT #
             actual = parser.parse(ARBITRARY_FS_LOCATION_INFO,
                                   remaining_source(arguments))
             # ASSERT #
             expected_path = path_ddvs.of_rel_option(
                 RelOptionType.REL_CWD,
                 path_ddvs.constant_path_part('expected argument'))
             assertion = matches_path_sdv(expected_path, asrt.is_empty)
             assertion.apply_without_message(self, actual.destination)
예제 #7
0
def embryo_checker(
        is_after_act_phase: bool
) -> embryo_check.Checker[Optional[TextRenderer]]:
    return embryo_check.Checker(sut.EmbryoParser(is_after_act_phase))
예제 #8
0
 def apply(self, environment: PathResolvingEnvironmentPostSds):
     parser = sut.EmbryoParser(self.is_after_act_phase)
     instruction_embryo = parser.parse(ARBITRARY_FS_LOCATION_INFO,
                                       remaining_source(self.arguments))
     return instruction_embryo.custom_main(environment)