mirror of
https://github.com/NCBM/plyngent.git
synced 2026-07-23 05:55:16 +08:00
ci/lint: ruff format pass and fix compact seed test typing
Apply pending ruff format; narrow AssistantChatMessage.content before membership checks so basedpyright accepts Unset|None unions.
This commit is contained in:
@@ -96,9 +96,7 @@ def test_compact_disabled_when_max_tokens_zero() -> None:
|
||||
ToolChatMessage(content="x" * 500, tool_call_id="1"),
|
||||
]
|
||||
out = compact_messages_for_request(messages, max_tokens=0)
|
||||
assert out[0] is messages[0] or (
|
||||
isinstance(out[0], ToolChatMessage) and out[0].content == "x" * 500
|
||||
)
|
||||
assert out[0] is messages[0] or (isinstance(out[0], ToolChatMessage) and out[0].content == "x" * 500)
|
||||
|
||||
|
||||
def test_measure_messages_tokens_calibrates_to_api_hint() -> None:
|
||||
|
||||
@@ -53,8 +53,10 @@ def test_build_compacted_seed_messages() -> None:
|
||||
assert isinstance(seed[0], SystemChatMessage)
|
||||
assert seed[0].content == "sys"
|
||||
assert isinstance(seed[1], AssistantChatMessage)
|
||||
assert "summary text" in seed[1].content
|
||||
assert "session 3" in seed[1].content
|
||||
content = seed[1].content
|
||||
assert isinstance(content, str)
|
||||
assert "summary text" in content
|
||||
assert "session 3" in content
|
||||
|
||||
|
||||
class SummaryClient:
|
||||
|
||||
@@ -617,7 +617,6 @@ async def test_retry_after_resume_orphan_user() -> None:
|
||||
await store.close()
|
||||
|
||||
|
||||
|
||||
async def test_chat_agent_system_prompt_prepended() -> None:
|
||||
from plyngent.lmproto.openai_compatible.model import SystemChatMessage
|
||||
|
||||
|
||||
@@ -142,9 +142,7 @@ async def test_rounds(state: ReplState) -> None:
|
||||
assert state.agent.max_rounds == 40
|
||||
|
||||
|
||||
async def test_status_shows_context_tokens(
|
||||
state: ReplState, capsys: pytest.CaptureFixture[str]
|
||||
) -> None:
|
||||
async def test_status_shows_context_tokens(state: ReplState, capsys: pytest.CaptureFixture[str]) -> None:
|
||||
from plyngent.agent.usage import TokenUsage
|
||||
from plyngent.lmproto.openai_compatible.model import UserChatMessage
|
||||
|
||||
|
||||
@@ -41,4 +41,3 @@ max_context_tokens = 5000
|
||||
assert store.agent_config.confirm_destructive is False
|
||||
assert store.agent_config.path_denylist == ["/secrets/", ".ssh/"]
|
||||
assert store.agent_config.max_context_tokens == 5000
|
||||
|
||||
|
||||
@@ -13,9 +13,7 @@ def test_classify_delete_and_move() -> None:
|
||||
|
||||
def test_classify_copy_overwrite_only() -> None:
|
||||
assert classify_danger("copy_path", {"src": "a", "dst": "b"}) is None
|
||||
assert "overwrite" in (
|
||||
classify_danger("copy_path", {"src": "a", "dst": "b", "overwrite": True}) or ""
|
||||
)
|
||||
assert "overwrite" in (classify_danger("copy_path", {"src": "a", "dst": "b", "overwrite": True}) or "")
|
||||
|
||||
|
||||
def test_classify_write_file_overwrite(workspace: object) -> None:
|
||||
|
||||
Reference in New Issue
Block a user