* Aggiorna gli agenti e il modello del team per utilizzare OLLAMA_QWEN_1B * Riorganizza e rinomina funzioni di estrazione in moduli di mercato e notizie; migliora la gestione delle importazioni * Spostato main nel corretto file __main__ e aggiornato il README.md * Aggiunta cartella per i modelli, agenti e team * Aggiornata la posizione delle istruzioni * Rimossi TODO e Aggiunto documentazione per metodi aggregated * Aggiornate le istruzioni del coordinatore del team * utils type checks * Rinominato BaseWrapper in MarketWrapper e fix type check markets * fix type checks di notizie e social. * Aggiunti type hints finali * Riorganizzati gli import * Refactoring architetturale e spostamento classi base - Eliminazione del file __init__.py obsoleto che importava ChatManager e Pipeline - Spostamento della classe Pipeline in agents/pipeline.py - Spostamento della classe ChatManager in utils/chat_manager.py - Aggiornamento di __main__.py per importare da app.utils e app.agents, e modifica della logica per utilizzare Pipeline invece di chat per la selezione di provider e stile - Creazione della cartella base con classi base comuni: markets.py (ProductInfo, Price, MarketWrapper), news.py (Article, NewsWrapper), social.py (SocialPost, SocialComment, SocialWrapper) - Aggiornamento di tutti gli import nel progetto (markets/, news/, social/, utils/, tests/) per utilizzare la nuova struttura base/ * Aggiornato Readme * Corretto il valore predefinito della valuta in BinanceWrapper da "USDT" a "USD" * fix type in tests * fix type per models * Rinominato 'quote_currency' in 'currency' e aggiornato il trattamento del timestamp in Price * fix errors found by Copilot * WrapperHandler: semplificata la logica di chiamata delle funzioni sui wrapper * fix docs * fix demos, semplificata logica lista ollama
42 lines
1.5 KiB
Python
42 lines
1.5 KiB
Python
import pytest
|
|
from app.markets import MarketAPIsTool
|
|
|
|
|
|
@pytest.mark.tools
|
|
@pytest.mark.market
|
|
@pytest.mark.api
|
|
class TestMarketAPIsTool:
|
|
def test_wrapper_initialization(self):
|
|
market_wrapper = MarketAPIsTool("EUR")
|
|
assert market_wrapper is not None
|
|
assert hasattr(market_wrapper, 'get_product')
|
|
assert hasattr(market_wrapper, 'get_products')
|
|
assert hasattr(market_wrapper, 'get_historical_prices')
|
|
|
|
def test_wrapper_capabilities(self):
|
|
market_wrapper = MarketAPIsTool("EUR")
|
|
capabilities: list[str] = []
|
|
if hasattr(market_wrapper, 'get_product'):
|
|
capabilities.append('single_product')
|
|
if hasattr(market_wrapper, 'get_products'):
|
|
capabilities.append('multiple_products')
|
|
if hasattr(market_wrapper, 'get_historical_prices'):
|
|
capabilities.append('historical_data')
|
|
assert len(capabilities) > 0
|
|
|
|
def test_market_data_retrieval(self):
|
|
market_wrapper = MarketAPIsTool("EUR")
|
|
btc_product = market_wrapper.get_product("BTC")
|
|
assert btc_product is not None
|
|
assert hasattr(btc_product, 'symbol')
|
|
assert hasattr(btc_product, 'price')
|
|
assert btc_product.price > 0
|
|
|
|
def test_error_handling(self):
|
|
try:
|
|
market_wrapper = MarketAPIsTool("EUR")
|
|
fake_product = market_wrapper.get_product("NONEXISTENT_CRYPTO_SYMBOL_12345")
|
|
assert fake_product is None or fake_product.price == 0
|
|
except Exception as _:
|
|
pass
|