Skip to content

Commit 68f41f4

Browse files
clean up: shared component wired
1 parent 53689dc commit 68f41f4

1 file changed

Lines changed: 13 additions & 16 deletions

File tree

tests/test_dual_path_parity_oracle.py

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@
3939
ADVERSARIAL_PAYLOAD: str = "<img src=x onerror=alert(1)>"
4040

4141

42+
def _adversarial_bash_tr() -> dict[str, object]:
43+
"""toolUseResult-shaped blob used by Part A parity tests."""
44+
return {
45+
"stdout": ADVERSARIAL_PAYLOAD,
46+
"exitCode": 0,
47+
"stderr": "",
48+
"interrupted": False,
49+
"is_error": False,
50+
}
51+
52+
4253
# ---------------------------------------------------------------------------
4354
# Helpers
4455
# ---------------------------------------------------------------------------
@@ -89,14 +100,7 @@ def test_adversarial_bash_blob_dispatches_to_bash() -> None:
89100
This drives the real ``_parse_tool_result`` dispatch path; a registry miss
90101
would produce result_type='unknown' and the assertion would fail.
91102
"""
92-
tr: dict[str, object] = {
93-
"stdout": ADVERSARIAL_PAYLOAD,
94-
"exitCode": 0,
95-
"stderr": "",
96-
"interrupted": False,
97-
"is_error": False,
98-
}
99-
parsed = _parse_tool_result(tr)
103+
parsed = _parse_tool_result(_adversarial_bash_tr())
100104

101105
assert parsed is not None
102106
assert parsed["result_type"] == "bash", (
@@ -115,14 +119,7 @@ def test_adversarial_bash_result_python_path_wraps_in_code_fence() -> None:
115119
(renderer regressed to raw prose), ``opening_fence`` below would be None and
116120
the assertion would fail — a diverging renderer cannot pass this test.
117121
"""
118-
tr: dict[str, object] = {
119-
"stdout": ADVERSARIAL_PAYLOAD,
120-
"exitCode": 0,
121-
"stderr": "",
122-
"interrupted": False,
123-
"is_error": False,
124-
}
125-
parsed = _parse_tool_result(tr)
122+
parsed = _parse_tool_result(_adversarial_bash_tr())
126123
assert parsed is not None
127124

128125
md = _render_tool_result(parsed)

0 commit comments

Comments
 (0)