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