From: Christian Heller Date: Fri, 6 Mar 2026 01:20:26 +0000 (+0100) Subject: In line drawing testing, don't ignore whitespace characters' attributes. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/conditions?a=commitdiff_plain;h=5178b85c6809f9adb3e0de315bf8725d571a6e4b;p=ircplom In line drawing testing, don't ignore whitespace characters' attributes. --- diff --git a/src/ircplom/testing.py b/src/ircplom/testing.py index bc9fe66..92c8ea6 100644 --- a/src/ircplom/testing.py +++ b/src/ircplom/testing.py @@ -103,25 +103,27 @@ class TestTerminal(QueueMixin, TerminalInterface): assert 0 <= y < self.size.y assert 0 <= x < self.size.x text = _SCREENLINE_IGNORE_CHAR * x + text + idx_padding: Optional[int] = None if text.endswith(_SCREENLINE_PADDING_SUFFIX): text = text[:-len(_SCREENLINE_PADDING_SUFFIX)] + idx_padding = len(text) text += ' ' * (self.size.x - self.len_to_term(text)) jumped_nones = 0 - for idx, cell_expected in enumerate( + for idx_in_assertion, cell_expected in enumerate( (tuple(attrs_str.split(_SEP_1)), c) for c in text): - - cell_found = self._screen[y][idx+jumped_nones] + idx_with_jumped_nones = idx_in_assertion + jumped_nones + cell_found = self._screen[y][idx_with_jumped_nones] if cell_found is None: jumped_nones += 1 continue if _SCREENLINE_IGNORE_CHAR == cell_expected[1]: continue - info = ('AT_X', idx, + info = ('AT_X', idx_with_jumped_nones, 'CHAR EXPECTED', cell_expected, 'FOUND', cell_found, 'FULL LINE EXPECTED', text, 'FOUND', ''.join(t[1] for t in self._screen[y] if t)) assert cell_expected[1] == cell_found[1], info - if cell_expected[1] != ' ': + if idx_padding is None or idx_in_assertion < idx_padding: assert cell_expected[0] == cell_found[0], info