コード例 #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)
コード例 #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."
     )
コード例 #3
0
ファイル: test_exceptions.py プロジェクト: toddrob99/praw
 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")
コード例 #4
0
ファイル: test_exceptions.py プロジェクト: toddrob99/praw
 def test_str(self):
     assert str(WebSocketException("", None)) == ""
     assert (str(WebSocketException("error message",
                                    None)) == "error message")
コード例 #5
0
ファイル: test_exceptions.py プロジェクト: toddrob99/praw
 def test_inheritance(self):
     assert isinstance(WebSocketException(None, None), ClientException)