Esempio n. 1
0
    def test_exception_serialization(self, exception, error):
        assert exception.__traceback__
        assert error.result().error is exception

        other = ErrorResultMessage.from_bytes(bytes(error))
        other_exc = other.result().error

        assert type(other_exc) is type(exception)
        assert other_exc.args == exception.args
        assert not other_exc.__traceback__
Esempio n. 2
0
 def test_from_bytes_failure(self):
     with pytest.raises(ValueError):
         ErrorResultMessage.from_bytes(b"random bytes")
Esempio n. 3
0
 def test_from_bytes_success(self, error):
     other = ErrorResultMessage.from_bytes(bytes(error))
     assert other is not error
     assert other == error
     assert type(other.result().error) == type(error.result().error)  # pylint: disable=C0123
     assert other.result().error.args == error.result().error.args
Esempio n. 4
0
 def error(self, exception):
     return ErrorResultMessage(exception)