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), ), )
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()), ), (), )
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()))
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))
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), )