"""Tests for the scraping modules.""" import pytest class TestProxyManager: def test_initialization(self): from src.scraper.proxy_manager import ProxyManager pm = ProxyManager() assert pm.pool_size == 0 assert not pm.has_proxies def test_add_proxy(self): from src.scraper.proxy_manager import ProxyManager pm = ProxyManager() pm.add_proxy("http://proxy1:8080") pm.add_proxy("http://proxy2:8080") assert pm.pool_size == 2 class TestBrowserFallback: def test_cloudflare_detection(self): from src.scraper.browser_fallback import is_cloudflare_blocked assert is_cloudflare_blocked("Checking your browser... Cloudflare") assert is_cloudflare_blocked("Just a moment...") assert not is_cloudflare_blocked("Normal page") class TestFantacalcioScraper: def test_normalize_name(self): from src.features.player_features import PlayerFeatureBuilder assert PlayerFeatureBuilder.normalize_name("Victor Osimhen") == "osimhen" assert PlayerFeatureBuilder.normalize_name("Khvicha Kvaratskhelia") == "kvaratskhelia" assert PlayerFeatureBuilder.normalize_name("Çalhanoğlu") == "calhanoglu" class TestFBrefScraper: def test_constants(self): from src.scraper.fbref_scraper import FBREF_BASE, STAT_CATEGORIES, KEEPER_CATEGORIES assert "11" in FBREF_BASE # Serie A competition ID assert "stats" in STAT_CATEGORIES assert "keepers" in KEEPER_CATEGORIES assert "keepersadv" in KEEPER_CATEGORIES