Files
odysseus/tests/test_editor_saved_observation.py
T
pewdiepie-archdaemon 2e8413a54a Preserve preview harness, editor, email and task improvements
Snapshot current maintainer-preview application changes and regression fixtures for integration into lab. Excludes local runtime data, evaluation outputs and source backups. Focused Python regression selection: 140 passed; full suite not certified.
2026-10-01 01:34:26 +00:00

25 lines
993 B
Python

import json
from src.clean_agent_preview import preview_tool_result_text
def test_successful_edit_exposes_saved_source_not_old_find():
observation = json.loads(preview_tool_result_text(
{'doc_id': 'fixture', 'applied': 1, 'version': 2, 'content': 'new wording'},
'edit_document', {'edits': [{'find': 'old wording', 'replace': 'new wording'}]},
))
assert observation['current_content'] == 'new wording'
assert observation['version'] == 2
assert 'Saved source' in observation['content_state']
def test_large_edit_observation_keeps_partial_failure_details():
observation = json.loads(preview_tool_result_text(
{'doc_id': 'fixture', 'applied': 1, 'content': 'a' * 10000,
'partial': True, 'rejected': 1, 'invalid_edits': [{'number': 2}]},
'edit_document', {},
))
assert 'current_content' not in observation
assert observation['invalid_edits'] == [{'number': 2}]
assert 'Retry only' in observation['instruction']