File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -163,8 +163,11 @@ def __init__(
163163
164164 def reliability_check (self ):
165165
166- if self .agents is None :
167- raise ValueError ("Agents list is empty" )
166+ if not self .agents :
167+ raise ValueError ("Agents list cannot be None or empty" )
168+
169+ if self .max_loops <= 0 :
170+ raise ValueError ("max_loops must be greater than 0" )
168171
169172 # Log the agents in a more formatted, readable way
170173 agent_list = "\n " .join (
Original file line number Diff line number Diff line change @@ -174,6 +174,14 @@ def test_majority_voting_error_handling():
174174 except ValueError as e :
175175 assert "max_loops" in str (e ).lower () or "0" in str (e )
176176
177+ try :
178+ MajorityVoting (agents = [analyst ], max_loops = - 1 )
179+ assert (
180+ False
181+ ), "Should have raised ValueError for negative max_loops"
182+ except ValueError as e :
183+ assert "max_loops" in str (e ).lower ()
184+
177185
178186def test_majority_voting_different_output_types ():
179187 """Test MajorityVoting with different output types"""
You can’t perform that action at this time.
0 commit comments