@@ -516,6 +516,82 @@ class LedgerAndApplicationTests(unittest.TestCase):
|
||||
)
|
||||
)
|
||||
|
||||
def test_local_game_status_question_answers_without_direct_chat(self):
|
||||
person = self.application.ledger.resolve_person("group-a", "Bob")
|
||||
account = MODULE.normalize_player_account({})
|
||||
account["game"] = {
|
||||
"bet": 50,
|
||||
"deck": [1, 2, 3],
|
||||
"player": [5, 10],
|
||||
"dealer": [8, 2],
|
||||
"updated_at": time.time(),
|
||||
"index": 1,
|
||||
}
|
||||
with self.application.ledger.lock, self.application.ledger.connection:
|
||||
self.application.ledger._save_player_account(
|
||||
"group-a",
|
||||
str(person["person_key"]),
|
||||
account,
|
||||
MODULE.utc_now(),
|
||||
)
|
||||
self.application.deepseek.complete = mock.Mock(
|
||||
side_effect=AssertionError("direct chat should not run")
|
||||
)
|
||||
|
||||
response = self.application.accept(
|
||||
event("bob-local-status", "@JWeBot Bob 在玩什么吗", sender="Alice")
|
||||
)
|
||||
|
||||
self.assertEqual(response["text"].count("喵"), 1)
|
||||
self.assertIn("bob 在玩单人21点 #1", response["text"])
|
||||
self.assertIn("16点", response["text"])
|
||||
self.assertEqual(response["execution_path"], "local-command")
|
||||
self.assertEqual(
|
||||
self.application.ledger.row("bob-local-status")["status"],
|
||||
"chat_completed",
|
||||
)
|
||||
self.assertEqual(
|
||||
self.application.ledger.status()["direct_chat_pending"],
|
||||
0,
|
||||
)
|
||||
self.application.deepseek.complete.assert_not_called()
|
||||
|
||||
def test_short_evaluation_uses_active_taffy_thread(self):
|
||||
observed_context = []
|
||||
|
||||
def complete(**kwargs):
|
||||
observed_context[:] = list(kwargs["context"])
|
||||
return "他那手确实挺敢喵"
|
||||
|
||||
self.application.deepseek.complete = complete
|
||||
self.application.deliver = mock.Mock()
|
||||
self.application.ledger.reserve_clock_broadcast(
|
||||
group_fingerprint="group-a",
|
||||
slot_key="hourly:2026-10-21T18",
|
||||
local_date="2026-10-21",
|
||||
kind="ambient_chat",
|
||||
message="21点那把16点还敢停牌喵",
|
||||
)
|
||||
self.assertTrue(
|
||||
self.application.ledger.complete_clock_broadcast(
|
||||
"group-a",
|
||||
"hourly:2026-10-21T18",
|
||||
)
|
||||
)
|
||||
|
||||
self.application.accept(
|
||||
event("short-active-thread", "@JWeBot 还真是 胆子大", sender="Alice")
|
||||
)
|
||||
self.application.process_direct_chat_once()
|
||||
|
||||
self.assertTrue(
|
||||
any(
|
||||
"active_thread" in item["tags"]
|
||||
and "16点还敢停牌" in item["taffy_text"]
|
||||
for item in observed_context
|
||||
)
|
||||
)
|
||||
|
||||
def test_route_and_ack_telemetry_is_privacy_safe(self):
|
||||
observed = []
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
@@ -1215,9 +1291,9 @@ class LedgerAndApplicationTests(unittest.TestCase):
|
||||
self.assertEqual(version["route"], "local")
|
||||
self.assertIn("JWeBot 版本", version["text"])
|
||||
self.assertIn("kernel", version["text"])
|
||||
self.assertIn("最新版本:beta 2.0.1.1021", version["text"])
|
||||
self.assertIn("更新时间:2026-10-21 17:32:46", version["text"])
|
||||
self.assertIn("更新摘要:上下文管理小版本更新完成", version["text"])
|
||||
self.assertIn("最新版本:beta 2.0.2.1021", version["text"])
|
||||
self.assertIn("更新时间:2026-10-21 18:11:35", version["text"])
|
||||
self.assertIn("更新摘要:上下文追问小版本更新完成", version["text"])
|
||||
self.assertEqual(debug["route"], "local")
|
||||
self.assertIn("调试埋点", debug["text"])
|
||||
self.assertEqual(balance["route"], "local")
|
||||
|
||||
@@ -20,7 +20,7 @@ SPEC.loader.exec_module(MODULE)
|
||||
|
||||
|
||||
class ReleaseUpdateTests(unittest.TestCase):
|
||||
release = "beta 2.0.1.1021"
|
||||
release = "beta 2.0.2.1021"
|
||||
major_release = "beta 2.0.0.1021"
|
||||
|
||||
def setUp(self):
|
||||
|
||||
Reference in New Issue
Block a user