diff --git a/tests/test_labeling.py b/tests/test_labeling.py index 7acbd30e6..73db331f6 100644 --- a/tests/test_labeling.py +++ b/tests/test_labeling.py @@ -273,8 +273,9 @@ def fake_call(prompt, *, backend, max_tokens=200): monkeypatch.setattr("graphify.llm._call_llm", fake_call) labels = label_communities(G, communities, backend="gemini", batch_size=100) - # 250 communities / 100 per batch -> 3 batches (100, 100, 50) - assert calls == [100, 100, 50] + # 250 communities / 100 per batch -> 3 batches (100, 100, 50). + # Concurrent workers may reach the backend in any order. + assert sorted(calls) == [50, 100, 100] # And every community got a real name, none left as a placeholder. assert all(name.startswith("Cluster ") for name in labels.values()), \ f"some communities still have placeholders: {[k for k, v in labels.items() if not v.startswith('Cluster ')][:5]}"