Exemplo n.º 1
0
 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)
Exemplo n.º 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 PRAW 8.0."
     )
Exemplo n.º 3
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")
Exemplo n.º 4
0
 def test_str(self):
     assert str(WebSocketException("", None)) == ""
     assert (str(WebSocketException("error message",
                                    None)) == "error message")
Exemplo n.º 5
0
 def test_inheritance(self):
     assert isinstance(WebSocketException(None, None), ClientException)