Commit 61904bd5 authored by Vincent Michel's avatar Vincent Michel
Browse files

Add error tests

parent 3d761ade
......@@ -53,3 +53,6 @@ doc/_build/
# PyCharm projects files
# Coverage
\ No newline at end of file
import pytest
from handel.error import HandelError, check_return_value
def f(x):
return x
def test_no_error():
assert f(0) is None
def test_known_error():
with pytest.raises(HandelError) as context:
assert str(context.value) == '[HandelError 801] UNIT_TEST'
def test_known_error_with_description():
with pytest.raises(HandelError) as context:
assert str(context.value) == '[HandelError 404] EOF: EOF encountered'
def test_unknown_error():
with pytest.raises(HandelError) as context:
assert str(context.value) == '[HandelError 802] UNKNOWN_ERROR_CODE'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment