b6539802e0
- mv src/multi_swarm → src/multi_swarm_core/multi_swarm_core (member layout) - sed-replace globale degli import: from/import multi_swarm.* → multi_swarm_core.* - 115 occorrenze aggiornate in src/ scripts/ tests/ - multi_swarm_coevolutive (nome repo) preservato dal word boundary Pre-condizione per il setup uv workspace della Fase 3. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
import pytest
|
|
|
|
from multi_swarm_core.cerbero.tools import CerberoTools
|
|
|
|
|
|
def test_tools_dispatch_sma(mocker):
|
|
fake_client = mocker.MagicMock()
|
|
fake_client.call_tool.return_value = {"value": 100.0}
|
|
t = CerberoTools(fake_client)
|
|
out = t.sma(exchange="bybit", symbol="BTCUSDT", timeframe="1h", length=20)
|
|
fake_client.call_tool.assert_called_once_with(
|
|
"bybit", "sma", {"symbol": "BTCUSDT", "timeframe": "1h", "length": 20}
|
|
)
|
|
assert out == {"value": 100.0}
|
|
|
|
|
|
def test_tools_dispatch_rsi(mocker):
|
|
fake_client = mocker.MagicMock()
|
|
fake_client.call_tool.return_value = {"value": 55.0}
|
|
t = CerberoTools(fake_client)
|
|
out = t.rsi(exchange="bybit", symbol="BTCUSDT", timeframe="1h", length=14)
|
|
fake_client.call_tool.assert_called_once_with(
|
|
"bybit", "rsi", {"symbol": "BTCUSDT", "timeframe": "1h", "length": 14}
|
|
)
|
|
assert out == {"value": 55.0}
|
|
|
|
|
|
def test_tools_unknown_raises(mocker):
|
|
fake_client = mocker.MagicMock()
|
|
t = CerberoTools(fake_client)
|
|
with pytest.raises(AttributeError):
|
|
t.nonexistent_tool() # type: ignore[attr-defined]
|