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)
示例#2
0
 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 Async PRAW 8.0."
     )
 def test_str(self):
     assert str(WebSocketException("", None)) == ""
     assert str(WebSocketException("error message", None)) == "error message"