52839a9bc8
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G796GsLCvJQKVN7hwV2cDx
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
from lyra import tools
|
|
from lyra.poker_contract import OPERATIONS
|
|
|
|
|
|
def test_llm_tool_required_args_match_contract():
|
|
for op, decl in OPERATIONS.items():
|
|
name = decl["llm_tool"]
|
|
if not name:
|
|
continue
|
|
spec = tools.TOOLS[name]["spec"]
|
|
required = set(spec["function"]["parameters"]["required"])
|
|
assert required == set(decl["required"]), (
|
|
f"{op}: tools spec required {required} != contract {set(decl['required'])}"
|
|
)
|
|
|
|
|
|
def test_rest_routes_registered():
|
|
import lyra.web.server as server
|
|
registered = set()
|
|
for route in server.app.routes:
|
|
methods = getattr(route, "methods", None)
|
|
path = getattr(route, "path", None)
|
|
if not methods or not path:
|
|
continue
|
|
for m in methods:
|
|
registered.add((m, path))
|
|
for op, decl in OPERATIONS.items():
|
|
if not decl["rest"]:
|
|
continue
|
|
method, path = decl["rest"]
|
|
assert (method, path) in registered, f"{op}: {method} {path} not registered"
|