From e03918112e212d7fcb95ccd893095bafdaf75a9f Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Tue, 21 Oct 2025 01:09:43 +0200 Subject: [PATCH] Fix broken testing repeat line indices (plus some minor refactoring). --- src/ircplom/testing.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/ircplom/testing.py b/src/ircplom/testing.py index 36e3d7a..406d2f1 100644 --- a/src/ircplom/testing.py +++ b/src/ircplom/testing.py @@ -190,13 +190,11 @@ class _Playbook: new_lines_t: list[tuple[str, str]] = [] for line_t in reversed(self._lines_t): cmd_name, remains = line_t[1].split(_SEP_0, maxsplit=1) - inserts = [line_t] - if cmd_name == marker: - inserts = parse_into( - line_t[0], - self._args_for_cmd(cmd_name, remains), - **kwargs) - new_lines_t[0:0] = inserts + new_lines_t[0:0] = ( + [line_t] if cmd_name != marker + else parse_into(line_t[0], + self._args_for_cmd(cmd_name, remains), + **kwargs)) self._lines_t = new_lines_t def split_server_put_and_log(index_str: str, @@ -218,8 +216,9 @@ class _Playbook: **__ ) -> list[tuple[str, str]]: candidates = [ - lt for lt in self._lines_t[int(anchors[args[0]+'-in']): - int(anchors[args[0]+'-out'])] + (_SEP_2.join((index_str, _TOK_IDX_REPEAT, lt[0])), lt[1]) + for lt in self._lines_t[int(anchors[args[0]+'-in']): + int(anchors[args[0]+'-out'])] if not lt[1].startswith(_MARK_ANCHOR)] # keep anchors unique idx_rep_offset = _SIGNATURE_FOR_CMD[_MARK_REPEAT][1] assert idx_rep_offset is not None @@ -244,7 +243,7 @@ class _Playbook: inserts += [(candidate[0], cmd_name, cmd_args)] line_offset = 0 - (lowest_int or 0) return [ - (_SEP_2.join((index_str, _TOK_IDX_REPEAT, insert_t[0])), + (insert_t[0], _SEP_0.join( [insert_t[1]] + [arg if isinstance(arg, str) -- 2.30.2