예제 #1
0
 def new_structure_builder(self) -> StringSourceStructureBuilder:
     return StringSourceStructureBuilder(
         self._structure_header,
         (
             custom_details.optional_option(program_primitives.WITH_IGNORED_EXIT_CODE_OPTION_NAME,
                                            self._ignore_exit_code),
             custom_details.TreeStructure(self._command),
         ),
     )
예제 #2
0
 def _renderer(self) -> StructureRenderer:
     return renderers.NodeRendererFromParts(
         self._structure_header,
         None,
         (
             custom_details.optional_option(
                 names.RUN_WITH_IGNORED_EXIT_CODE_OPTION_NAME,
                 self._ignore_exit_code),
             custom_details.TreeStructure(self._program()),
         ),
         (),
     )
예제 #3
0
 def primitive(self, environment: ApplicationEnvironment) -> FileMaker:
     if self._optional_contents is None:
         return RegularFileMaker(
             self._modification,
             constant_str.string_source('', environment.tmp_files_space),
             None,
         )
     else:
         contents = self._optional_contents.primitive(environment)
         return RegularFileMaker(
             self._modification, contents,
             custom_details.TreeStructure(contents.structure()))
예제 #4
0
 def _all_match(self, tb: TraceBuilder,
                tot_num_elements: int) -> MatchingResult:
     actual = details.String(
         str_constructor.FormatPositional(
             'Every {} matches ({} tested)',
             self._conf.setup.rendering.type_name,
             tot_num_elements,
         ))
     expected = custom_details.TreeStructure(
         self._conf.predicate.structure())
     return (tb.append_details(
         custom_details.expected(expected)).append_details(
             custom_details.actual(actual)).build_result(True))
예제 #5
0
 def _explanation_when_no_element_matcher_trace(
         self, explanation: ToStringObject) -> DetailsRenderer:
     return custom_details.ExpectedAndActual(
         custom_details.TreeStructure(self._conf.predicate.structure()),
         details.String(explanation),
     )