From dca38f53d38afdb45b10aa663cd3386f084c5934 Mon Sep 17 00:00:00 2001 From: Sirhan1 Date: Mon, 13 Jul 2026 23:34:10 +0100 Subject: [PATCH] fix: make label batching test independent of order --- tests/test_labeling.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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]}"