oclaw/tests/test_direct_loop_reasoning_split.py
oliver 420abac9f1 refactor: root-package imports (svc/runtime/interfaces) and fix PYTHONPATH
- Rename platform/ to svc/ to avoid shadowing stdlib platform.
- Replace from oclaw.* with from svc/runtime/interfaces; update -m CLI paths.
- tests/conftest: prepend repo root to sys.path (no parent-folder package name).
- CI: paths and offline_eval script under repo root.
- Ops scripts: PYTHONPATH must be repo root for python -m runtime.* (fixes gateway/WhatsApp sidecar startup).
- Fix default oclaw.json path in tabular/file attachment limits; stabilize attachment test config.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-13 14:51:17 +08:00

28 lines
913 B
Python

from __future__ import annotations
from runtime.direct_loop import _split_reasoning_and_body
def test_split_reasoning_extracts_thinking_tags() -> None:
chunks, body = _split_reasoning_and_body("<thinking>\ninner\n</thinking>\nvisible")
assert chunks == ["inner"]
assert body == "visible"
def test_split_reasoning_extracts_thought_tags() -> None:
chunks, body = _split_reasoning_and_body("<thought>x</thought>after")
assert chunks == ["x"]
assert body == "after"
def test_split_reasoning_explicit_when_no_tags() -> None:
chunks, body = _split_reasoning_and_body("body only", explicit_reasoning=" rc ")
assert chunks == ["rc"]
assert body == "body only"
def test_split_reasoning_antml_optional_prefix() -> None:
raw = "<antml:thinking>\nZ\n</antml:thinking>\nok"
chunks, body = _split_reasoning_and_body(raw)
assert chunks == ["Z"]
assert body == "ok"