test: golden the key and fingerprint literals for a declared tier

The absent-tier side has had goldens since issue #4; the side that
actually carries a tier had none, so swapping str() for repr() in the
cache key changed the literal without turning the suite red. Pin both
literals. Note the fingerprint's json.dumps emits the same bytes for an
Effort member and its .value, so that pair is indistinguishable by any
test -- the golden pins the literal itself instead.
This commit is contained in:
2026-09-05 04:27:39 -04:00
parent 468af53f51
commit d1b3563183
2 changed files with 37 additions and 0 deletions
+14
View File
@@ -516,6 +516,20 @@ class TestModelFingerprint:
assert build_model_fingerprint([_source(extra_body={"temperature": 0})]) == expected
def test_declared_tier_fingerprint_is_a_golden(self):
"""配了档位那一侧的指纹字面量也要钉死: 它变了就是该源整段缓存冷启动。
存量(不表态)那侧由 `test_absent_tier_fingerprint_is_byte_identical_to_before`
守着;本条守的是"档位怎么摘要进 mark"。字面量硬编码,不在测试里重算——
重算等于把实现抄一遍,实现改了两边一起变,断言就白写了。
"""
from polygateway.client import build_model_fingerprint
assert build_model_fingerprint([_source(reasoning_effort=Effort.LOW)]) == (
"qwen-max|76f2b3e419e1a727f7f31b6144da0b40d62a00ca93c91ce5901b4ebd48c0b8c0"
)
class TestFactories:
def test_from_env_assembles(self):
client = GatewayClient.from_env("LLM", env=_ENV)