mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 07:13:17 +08:00
- 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>
28 lines
913 B
Python
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"
|