Skip to content

Commit 64367bc

Browse files
committed
drop the test file; the fix is a small change to one function
1 parent 03b48aa commit 64367bc

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
@@ -1218,67 +1218,3 @@ def test_img_length_mismatch_raises(self):
12181218

12191219
if __name__ == "__main__":
12201220
pytest.main([__file__, "-v"])
1221-
1222-
1223-
def test_forwarders_do_not_advertise_an_unusable_args():
1224-
"""`*args` on these forwarders could never carry a value.
1225-
1226-
Each one forwarded as `self._run(task=task, img=img, *args, **kwargs)`.
1227-
Python evaluates that as `self._run(*args, task=task, ...)`, so the first
1228-
splatted positional binds to the callee's first parameter — the one
1229-
already supplied by keyword — and any non-empty `*args` raised
1230-
`TypeError: _run() got multiple values for argument 'task'`.
1231-
1232-
The parameter is gone rather than forwarded positionally: aligning the
1233-
lists is what put a third positional into `run()`'s `imgs` slot (#1879).
1234-
Extras remain reachable by name through `**kwargs`, which every one of
1235-
these still accepts.
1236-
"""
1237-
import inspect
1238-
1239-
from swarms.agents.consistency_agent import SelfConsistencyAgent
1240-
from swarms.structs.agent import Agent
1241-
from swarms.structs.hiearchical_swarm import HierarchicalSwarm
1242-
from swarms.structs.swarm_router import SwarmRouter
1243-
1244-
forwarders = [
1245-
(Agent, "run"),
1246-
(Agent, "receive_message"),
1247-
(Agent, "run_concurrent_tasks"),
1248-
(Agent, "_run_autonomous_loop"),
1249-
(AgentRearrange, "run"),
1250-
(AgentRearrange, "concurrent_run"),
1251-
(SwarmRouter, "run"),
1252-
(HierarchicalSwarm, "arun"),
1253-
(SelfConsistencyAgent, "run"),
1254-
]
1255-
1256-
for cls, name in forwarders:
1257-
params = inspect.signature(
1258-
getattr(cls, name)
1259-
).parameters.values()
1260-
assert not [
1261-
p for p in params if p.kind is p.VAR_POSITIONAL
1262-
], f"{cls.__name__}.{name} still advertises an unusable *args"
1263-
assert [
1264-
p for p in params if p.kind is p.VAR_KEYWORD
1265-
], f"{cls.__name__}.{name} lost **kwargs, so extras are unreachable"
1266-
1267-
1268-
def test_extra_positional_now_fails_at_the_boundary():
1269-
"""The error names the method the caller actually called.
1270-
1271-
Previously it surfaced from the inner callee (`_run() got multiple
1272-
values for argument 'task'`), which points at a private method the
1273-
caller never mentioned.
1274-
"""
1275-
import pytest
1276-
1277-
class _Bare(AgentRearrange):
1278-
def __init__(
1279-
self,
1280-
): # skip validation; only the signature matters
1281-
pass
1282-
1283-
with pytest.raises(TypeError, match="AgentRearrange.run"):
1284-
AgentRearrange.run(_Bare(), "task", None, "extra")

0 commit comments

Comments
 (0)