def render(self) -> Sequence[Detail]: ret_val = [tree.StringDetail(self._path.value.render())] if self._path.resolving_dependency is DirectoryStructurePartition.HDS: ret_val.append( tree.IndentedDetail( (tree.StringDetail(self._path.primitive.render()), ))) return ret_val
def __init__(self, result: bool): self._result = result self._matching_result = MatchingResult( self._result, renderers.Constant( tree.Node(logic.CONSTANT_MATCHER, self._result, (tree.StringDetail(logic.BOOLEANS[result]), ), ())), ) self._structure = renderers.Constant( tree.Node(logic.CONSTANT_MATCHER, None, (tree.StringDetail(logic.BOOLEANS[result]), ), ()))
def test(self): # ARRANGE # detail = sut.StringDetail('a detail') child = sut.Node('child header', False, (), ()) root_header = 'root header' root_data = True root = sut.Node(root_header, root_data, (detail,), (child,)) # ACT & ASSERT # self.assertEqual(root_header, root.header, 'root header') self.assertEqual(root_data, root.data, 'root data') expected_root_details = asrt.matches_singleton_sequence( asrt.is_(detail) ) expected_root_details.apply_with_message(self, root.details, 'root details') expected_root_children = asrt.matches_singleton_sequence( asrt.is_(child) ) expected_root_children.apply_with_message(self, root.children, 'root children')
def render(self) -> Sequence[Detail]: s = self._value s = s[:self._max_chars_to_print] sr = repr(s) if len(s) != len(self._value): sr = sr + HAS_MORE_DATA_MARKER return [tree.StringDetail(sr)]
def render(self) -> Sequence[Detail]: return [ tree.StringDetail(' '.join([ self._comparator.name, self._rhs.render(), ])) ]
def render(self) -> tree.Node[None]: return tree.Node( self.NAME, None, [tree.StringDetail(argument) for argument in self._arguments], (), )
def render(self) -> Sequence[Detail]: line = self._line return [ tree.StringDetail( str_constructor.FormatPositional( 'Line {}. {}', line[0], repr(line[1]), )) ]
def test_application(self): conf = self.configuration for value in [False, True]: conf.checker_for_parser_of_full_expr().check__w_source_variants( self, arguments=matcher_argument.Constant(value).as_arguments, input_=conf.arbitrary_model, arrangement=arrangement_wo_tcds(), expectation=Expectation(execution=ExecutionExpectation( main_result=asrt_matching_result.matches( asrt.equals(value), trace=_utils.trace_equals( tree.Node.leaf(logic.CONSTANT_MATCHER, value, ( tree.StringDetail(logic.BOOLEANS[value]), )))))))
def test_accept_visitor(self): # ARRANGE # visitor = _VisitorThatRegistersVisitedClassesAndReturnsConstant() detail = sut.StringDetail('the string') # ACT # detail.accept(visitor) # ASSERT # self.assertEqual(visitor.visited_classes, [sut.StringDetail], 'visited classes')
def test_attributes(self): # ARRANGE # header = 'the header' value = sut.StringDetail('the value detail header') detail = sut.HeaderAndValueDetail(header, [value]) # ACT & ASSERT # self.assertIs(header, detail.header, 'header') expected_values = asrt.matches_singleton_sequence(asrt.is_(value)) expected_values.apply_with_message(self, detail.values, 'values')
def test_attributes(self): # ARRANGE # a_detail = sut.StringDetail('the string') indented = [a_detail] detail = sut.IndentedDetail(indented) # ACT & ASSERT # self.assertIs(indented, detail.details, 'details') expected_values = asrt.matches_singleton_sequence(asrt.is_(a_detail)) expected_values.apply_with_message(self, detail.details, 'details')
def __init__(self, name: str, result: bool, ): super().__init__(result) self._name = name self._trace_tree = tree.Node(name, result, (tree.StringDetail(logic.BOOLEANS[result]),), ()) self._matching_result = MatchingResult( result, renderers.Constant( self._trace_tree ), )
def _render_string(x: ToStringObject) -> Detail: return tree.StringDetail(x)
def render(self) -> Sequence[Detail]: return [tree.StringDetail(self._to_string_object)]
def render(self) -> Sequence[Detail]: sr = repr(self._value) + HAS_MORE_DATA_MARKER return [tree.StringDetail(sr)]
def render(self) -> Sequence[Detail]: return [ tree.StringDetail(renderer.render()) for renderer in self._renderer.renders() ]
def render(self) -> Sequence[Detail]: return [ tree.StringDetail(self._path.value.render()), tree.StringDetail(self._path.primitive.render()), ]