diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-18 20:26:48 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-18 20:26:48 +0200 |
| commit | 122e50fb67540e24cc49b880fd78ba26ba043281 (patch) | |
| tree | aec2f96fbf1d371a3ad3dfd442a38569289e0575 | |
| parent | b724d2e9f2b02111e562d8759df326f314f66edc (diff) | |
| download | llamachat-122e50fb67540e24cc49b880fd78ba26ba043281.tar.gz llamachat-122e50fb67540e24cc49b880fd78ba26ba043281.zip | |
test: cover qualified-id modality mapping
| -rwxr-xr-x | test_llamachat.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/test_llamachat.py b/test_llamachat.py index 285492d..04c1bc5 100755 --- a/test_llamachat.py +++ b/test_llamachat.py @@ -2532,6 +2532,16 @@ def test_multi_client(): "meta-llama/Llama-3.3-70B", ], } + # Reported modalities, keyed by the provider's own bare model name. The + # local listing covers only gemma4, so qwen3.5-9b stays unreported. + reported_by_provider = { + "http://localhost:8181": { + "gemma4": frozenset({"text", "image", "audio"}), + }, + "https://api.example.org": { + "Qwen/Qwen2.5-72B": frozenset({"text", "image"}), + }, + } built = [] class _StubClient: @@ -2543,7 +2553,9 @@ def test_multi_client(): def models(self, list_timeout=30): if self.base_url not in listings: raise backend.BackendError(f"cannot reach {self.base_url}") - return listings[self.base_url], {} + return listings[self.base_url], reported_by_provider.get( + self.base_url, {} + ) multi = backend.MultiClient( table, timeout=300, resolver=providers.KeyResolver(), @@ -2555,8 +2567,12 @@ def test_multi_client(): # the Llama model out of together's listing. assert listed == ["gemma4", "qwen3.5-9b", "together:Qwen/Qwen2.5-72B"] - # The stub reports no modalities, so the map is empty. - assert modalities == {} + # The reported map is keyed by the id the UI uses: a bare local id stays + # bare, a cloud model gets its provider prefix. A model whose provider + # reported nothing is absent rather than invented. + assert modalities["gemma4"] == frozenset({"text", "image", "audio"}) + assert modalities["together:Qwen/Qwen2.5-72B"] == frozenset({"text", "image"}) + assert "qwen3.5-9b" not in modalities # The unreachable provider is reported, and did not break the rest. assert any("down" in p for p in problems) |
