Skip to content

Commit c788491

Browse files
committed
drop the test file; the fix is a small change to one function
1 parent cb109d5 commit c788491

1 file changed

Lines changed: 0 additions & 64 deletions

File tree

tests/structs/test_agent_rearrange.py

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,67 +1383,3 @@ def test_a_second_task_still_receives_the_full_context(self):
13831383

13841384
if __name__ == "__main__":
13851385
pytest.main([__file__, "-v"])
1386-
1387-
1388-
def test_forwarders_do_not_advertise_an_unusable_args():
1389-
"""`*args` on these forwarders could never carry a value.
1390-
1391-
Each one forwarded as `self._run(task=task, img=img, *args, **kwargs)`.
1392-
Python evaluates that as `self._run(*args, task=task, ...)`, so the first
1393-
splatted positional binds to the callee's first parameter — the one
1394-
already supplied by keyword — and any non-empty `*args` raised
1395-
`TypeError: _run() got multiple values for argument 'task'`.
1396-
1397-
The parameter is gone rather than forwarded positionally: aligning the
1398-
lists is what put a third positional into `run()`'s `imgs` slot (#1879).
1399-
Extras remain reachable by name through `**kwargs`, which every one of
1400-
these still accepts.
1401-
"""
1402-
import inspect
1403-
1404-
from swarms.agents.consistency_agent import SelfConsistencyAgent
1405-
from swarms.structs.agent import Agent
1406-
from swarms.structs.hiearchical_swarm import HierarchicalSwarm
1407-
from swarms.structs.swarm_router import SwarmRouter
1408-
1409-
forwarders = [
1410-
(Agent, "run"),
1411-
(Agent, "receive_message"),
1412-
(Agent, "run_concurrent_tasks"),
1413-
(Agent, "_run_autonomous_loop"),
1414-
(AgentRearrange, "run"),
1415-
(AgentRearrange, "concurrent_run"),
1416-
(SwarmRouter, "run"),
1417-
(HierarchicalSwarm, "arun"),
1418-
(SelfConsistencyAgent, "run"),
1419-
]
1420-
1421-
for cls, name in forwarders:
1422-
params = inspect.signature(
1423-
getattr(cls, name)
1424-
).parameters.values()
1425-
assert not [
1426-
p for p in params if p.kind is p.VAR_POSITIONAL
1427-
], f"{cls.__name__}.{name} still advertises an unusable *args"
1428-
assert [
1429-
p for p in params if p.kind is p.VAR_KEYWORD
1430-
], f"{cls.__name__}.{name} lost **kwargs, so extras are unreachable"
1431-
1432-
1433-
def test_extra_positional_now_fails_at_the_boundary():
1434-
"""The error names the method the caller actually called.
1435-
1436-
Previously it surfaced from the inner callee (`_run() got multiple
1437-
values for argument 'task'`), which points at a private method the
1438-
caller never mentioned.
1439-
"""
1440-
import pytest
1441-
1442-
class _Bare(AgentRearrange):
1443-
def __init__(
1444-
self,
1445-
): # skip validation; only the signature matters
1446-
pass
1447-
1448-
with pytest.raises(TypeError, match="AgentRearrange.run"):
1449-
AgentRearrange.run(_Bare(), "task", None, "extra")

0 commit comments

Comments
 (0)