""" Pytest fixtures for Warren Scanner tests """ import pytest from src.analysis.warren_analyzer import WarrenAnalyzer @pytest.fixture def analyzer(): """Crea istanza WarrenAnalyzer per test""" return WarrenAnalyzer() @pytest.fixture def normal_stock_data(): """Dati stock normale e di qualità""" return { 'ticker': 'TEST.MI', 'name': 'Test Company', 'sector': 'Industrials', 'price': 100.0, 'pe_ratio': 15.0, 'pb_ratio': 2.0, 'roe': 0.15, # 15% 'debt_to_equity': 0.5, 'dividend_yield': 0.03, # 3% 'revenue_growth': 0.10, # 10% 'earnings_growth': 0.12, # 12% 'market_cap': 1_000_000_000 } @pytest.fixture def luxury_stock_data(): """Dati luxury brand (Ferrari-like)""" return { 'ticker': 'RACE.MI', 'name': 'Ferrari', 'sector': 'Consumer Cyclical', 'price': 300.0, 'pe_ratio': 35.0, 'pb_ratio': 15.0, 'roe': 0.35, # 35% 'debt_to_equity': 0.3, 'dividend_yield': 0.01, # 1% 'revenue_growth': 0.15, 'earnings_growth': 0.20, 'market_cap': 50_000_000_000 } @pytest.fixture def financial_stock_data(): """Dati banca (debt alto normale)""" return { 'ticker': 'ISP.MI', 'name': 'Intesa Sanpaolo', 'sector': 'Financial Services', 'price': 3.0, 'pe_ratio': 8.0, 'pb_ratio': 0.8, 'roe': 0.10, # 10% 'debt_to_equity': 5.0, # Alto ma normale per banche 'dividend_yield': 0.05, # 5% 'revenue_growth': 0.05, 'earnings_growth': 0.08, 'market_cap': 40_000_000_000 } @pytest.fixture def low_quality_stock_data(): """Dati stock bassa qualità""" return { 'ticker': 'LOWQ.MI', 'name': 'Low Quality Corp', 'sector': 'Industrials', 'price': 50.0, 'pe_ratio': 50.0, # PE alto 'pb_ratio': 5.0, 'roe': 0.05, # ROE basso 5% 'debt_to_equity': 2.5, # Debt alto 'dividend_yield': 0.0, # No dividendo 'revenue_growth': -0.05, # Revenue decline 'earnings_growth': -0.10, # Earnings decline 'market_cap': 100_000_000 } @pytest.fixture def crisis_stock_data(): """Dati stock in crisi (growth fortemente negativo)""" return { 'ticker': 'CRISIS.MI', 'name': 'Crisis Company', 'sector': 'Industrials', 'price': 20.0, 'pe_ratio': 8.0, # PE basso per crisi 'pb_ratio': 0.5, 'roe': -0.10, # ROE negativo -10% 'debt_to_equity': 1.5, 'dividend_yield': 0.0, 'revenue_growth': -0.25, # -25% 'earnings_growth': -0.30, # -30% (forte decline) 'market_cap': 50_000_000 }