Skip to content

Commit 9a14235

Browse files
danielbentesclaude
andcommitted
fix(test): use replace newline, not collapse whitespace, to undo wrap
Previous fix used ``" ".join(out.split())`` which turned ``memori\nes.json`` into ``memori es.json`` — a stray space mid-token that still failed the substring match for ``memories.json``. The correct fix is ``out.replace("\n", "")`` (remove newlines without substituting whitespace) so wrapped tokens rejoin cleanly. Verified locally with COLUMNS=80 that the rich wrap now produces ``Skipping /tmp/.../memories.json: ...`` after the replace. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5aba014 commit 9a14235

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

tests/test_memory_ingest_path.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ def test_persist_memories_warns_on_malformed_file(
122122
{Source.CLAUDE_AI: bad_export},
123123
)
124124
assert persisted == 0
125-
# Collapse whitespace before substring search: rich wraps long paths
126-
# to terminal width, which on narrow CI runners splits ``memories.json``
127-
# across a line break (e.g. ``memori\nes.json``).
128-
out_collapsed = " ".join(capsys.readouterr().out.split())
129-
assert "Skipping" in out_collapsed and "memories.json" in out_collapsed
125+
# Strip newlines (not whitespace) before substring search: rich
126+
# wraps long paths to terminal width, which on narrow CI runners
127+
# splits ``memories.json`` mid-token (e.g. ``memori\nes.json``).
128+
# ``replace("\n", "")`` rejoins the token; collapsing whitespace
129+
# would leave a stray space mid-filename.
130+
out_unwrapped = capsys.readouterr().out.replace("\n", "")
131+
assert "Skipping" in out_unwrapped and "memories.json" in out_unwrapped

0 commit comments

Comments
 (0)