Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
23 lines
732 B
Python
23 lines
732 B
Python
import json
|
|
|
|
from airline_env import _run_tool
|
|
|
|
|
|
def test_baggage_policy_null_cabin():
|
|
# 模型显式传 {"cabin": null}:应回退到经济舱默认,而不是 TypeError
|
|
args = json.loads('{"cabin": null}')
|
|
result = json.loads(_run_tool("get_baggage_policy", args))
|
|
assert result["cabin"] == "经济舱"
|
|
assert result["free_allowance"] == "20kg"
|
|
|
|
|
|
def test_baggage_policy_missing_cabin():
|
|
result = json.loads(_run_tool("get_baggage_policy", {}))
|
|
assert result["cabin"] == "经济舱"
|
|
assert result["free_allowance"] == "20kg"
|
|
|
|
|
|
def test_baggage_policy_business_cabin():
|
|
result = json.loads(_run_tool("get_baggage_policy", {"cabin": "商务舱"}))
|
|
assert result["free_allowance"] == "30kg"
|