"""
Tests for web_search_engines/rate_limiting module

Tests cover:
- RateLimitError exception
- Basic module exports
"""

import pytest


class TestRateLimitError:
    """Tests for RateLimitError exception."""

    def test_rate_limit_error_is_exception(self):
        """Test RateLimitError is an exception class."""
        from local_deep_research.web_search_engines.rate_limiting import (
            RateLimitError,
        )

        assert issubclass(RateLimitError, Exception)

    def test_rate_limit_error_can_be_raised(self):
        """Test RateLimitError can be raised and caught."""
        from local_deep_research.web_search_engines.rate_limiting import (
            RateLimitError,
        )

        with pytest.raises(RateLimitError):
            raise RateLimitError("Rate limit exceeded")

    def test_rate_limit_error_message(self):
        """Test RateLimitError stores message."""
        from local_deep_research.web_search_engines.rate_limiting import (
            RateLimitError,
        )

        try:
            raise RateLimitError("Test message")
        except RateLimitError as e:
            assert "Test message" in str(e)


class TestModuleExports:
    """Tests for module exports."""

    def test_get_tracker_exists(self):
        """Test get_tracker function is exported."""
        from local_deep_research.web_search_engines.rate_limiting import (
            get_tracker,
        )

        assert get_tracker is not None
        assert callable(get_tracker)
