import pytest from pr.core.exceptions import ( PRException, APIException, APIConnectionError, APITimeoutError, APIResponseError, ConfigurationError, ToolExecutionError, FileSystemError, SessionError, ContextError, ValidationError, ) class TestExceptions: def test_pre_exception(self): with pytest.raises(PRException): raise PRException("test") def test_api_exception(self): with pytest.raises(APIException): raise APIException("test") def test_api_connection_error(self): with pytest.raises(APIConnectionError): raise APIConnectionError("test") def test_api_timeout_error(self): with pytest.raises(APITimeoutError): raise APITimeoutError("test") def test_api_response_error(self): with pytest.raises(APIResponseError): raise APIResponseError("test") def test_configuration_error(self): with pytest.raises(ConfigurationError): raise ConfigurationError("test") def test_tool_execution_error(self): error = ToolExecutionError("test_tool", "test message") assert error.tool_name == "test_tool" assert str(error) == "Error executing tool 'test_tool': test message" def test_file_system_error(self): with pytest.raises(FileSystemError): raise FileSystemError("test") def test_session_error(self): with pytest.raises(SessionError): raise SessionError("test") def test_context_error(self): with pytest.raises(ContextError): raise ContextError("test") def test_validation_error(self): with pytest.raises(ValidationError): raise ValidationError("test")