def test_exception_attr(self): exc = WebSocketException(None, None) assert exc.original_exception is None assert isinstance(WebSocketException(None, Exception()), Exception) assert (str( WebSocketException( None, Exception("test")).original_exception) == "test") exc.original_exception = Exception() assert isinstance(exc.original_exception, Exception) del exc.original_exception assert "_original_exception" not in vars(exc)
def test_web_socket_exception_attribute(self): exc = WebSocketException("Test", Exception("Test")) with pytest.raises(DeprecationWarning) as excinfo: _ = exc.original_exception assert ( excinfo.value.args[0] == "Accessing the attribute original_exception is deprecated. Please rewrite your code in such a way that this attribute does not need to be used. It will be removed in PRAW 8.0." )
def test_exception_attr(self): assert WebSocketException(None, None).original_exception is None assert isinstance(WebSocketException(None, Exception()), Exception) assert (str( WebSocketException( None, Exception("test")).original_exception) == "test")
def test_str(self): assert str(WebSocketException("", None)) == "" assert (str(WebSocketException("error message", None)) == "error message")
def test_inheritance(self): assert isinstance(WebSocketException(None, None), ClientException)