31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
from __future__ import annotations
|
|||
|
|
|
||
|
|
from scripts.eval.l2_api_eval import build_environment, run_l2_contract
|
||
|
|
|
||
|
|
|
||
|
|
def test_l2_contract_passes():
|
||
|
|
report = run_l2_contract()
|
||
|
|
|
||
|
|
assert report["total"] == 5
|
||
|
|
assert report["passed"] == 5
|
||
|
|
assert report["failed"] == 0
|
||
|
|
assert report["cleanup"] == "in_memory_disposed"
|
||
|
|
|
||
|
|
|
||
|
|
def test_l2_environment_restores_module_globals():
|
||
|
|
from scripts.eval import l2_api_eval
|
||
|
|
|
||
|
|
originals = {
|
||
|
|
"chat_repo": l2_api_eval.chat_mod._repo,
|
||
|
|
"chat_session_repo": l2_api_eval.chat_mod._session_repo,
|
||
|
|
"redis_gateway": l2_api_eval.redis_gateway._gateway,
|
||
|
|
"llm": l2_api_eval.agent_service._llm,
|
||
|
|
}
|
||
|
|
environment = build_environment(chunks=["eval"])
|
||
|
|
environment.close()
|
||
|
|
|
||
|
|
assert l2_api_eval.chat_mod._repo is originals["chat_repo"]
|
||
|
|
assert l2_api_eval.chat_mod._session_repo is originals["chat_session_repo"]
|
||
|
|
assert l2_api_eval.redis_gateway._gateway is originals["redis_gateway"]
|
||
|
|
assert l2_api_eval.agent_service._llm is originals["llm"]
|