def expected_detail_properties( depth: int, text_style: TextStyle = TEXT_STYLE__NEUTRAL) -> s.ElementProperties: return s.ElementProperties( Indentation(depth + 1, RENDERING_CONFIGURATION.detail_indent), text_style, )
def test_getters(self): # ARRANGE # parts = [] properties_arg = sut.ElementProperties(Indentation(0)) block = sut.MajorBlock(parts, properties_arg) # ACT && ASSERT # self.assertIs(parts, block.parts, 'parts') self.assertIs(properties_arg, block.properties, 'properties_arg')
def test_element_properties_SHOULD_be_ignored(self): # ARRANGE # ep_with_indent = s.ElementProperties( Indentation(1), TextStyle(color=ForegroundColor.BLUE, font_style=FontStyle.UNDERLINE), ) for case in self.cases: with self.subTest(case.name): # ACT & ASSERT # check_line_element( self, s.LineElement(case.actual, ep_with_indent), case.expected, )
def expected_node_properties(depth: int) -> s.ElementProperties: return s.ElementProperties( expected_node_indentation(depth), TEXT_STYLE__NEUTRAL, )
from pathlib import Path from typing import Sequence, Tuple, List, Optional from exactly_lib.definitions.formatting import SectionName from exactly_lib.section_document import defs from exactly_lib.section_document.source_location import SourceLocation, SourceLocationPath from exactly_lib.util.ansi_terminal_color import FontStyle from exactly_lib.util.render import combinators as comb from exactly_lib.util.render.renderer import Renderer, SequenceRenderer from exactly_lib.util.simple_textstruct import structure from exactly_lib.util.simple_textstruct.rendering import blocks, component_renderers as comp_rend from exactly_lib.util.simple_textstruct.rendering.components import LineObjectRenderer from exactly_lib.util.simple_textstruct.structure import StringLinesObject, LineElement, MinorBlock, StringLineObject, \ MajorBlock, PreFormattedStringLineObject, LineObject SOURCE_LINES_ELEMENT_PROPERTIES = structure.ElementProperties( structure.Indentation(1, ''), structure.TEXT_STYLE__NEUTRAL) SOURCE_LINES_BLOCK_PROPERTIES = structure.ElementProperties( structure.INDENTATION__NEUTRAL, structure.TextStyle(font_style=FontStyle.BOLD)) def line_number(n: int) -> str: return ''.join(['line ', str(n)]) def source_location_path( referrer_location: Path, source_location: SourceLocationPath) -> List[MinorBlock]: location = source_location.location source = location.source final_source_line_number = (None if source is None else
def expected_detail_properties(level: int) -> s.ElementProperties: return s.ElementProperties( Indentation(level, _EXPECTED_DETAIL_INDENT_SUFFIX), TEXT_STYLE__NEUTRAL, )