improve test - tests raising of error #257
This commit is contained in:
parent
128221363f
commit
d6d12f99d4
|
@ -12,12 +12,21 @@ from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import pytest
|
||||||
import escpos
|
import escpos
|
||||||
|
import escpos.exceptions
|
||||||
|
|
||||||
|
|
||||||
def test_raise_error():
|
def test_raise_error_wrongly():
|
||||||
"""raise error
|
"""raise error the wrong way
|
||||||
|
|
||||||
should reproduce https://github.com/python-escpos/python-escpos/issues/257
|
should reproduce https://github.com/python-escpos/python-escpos/issues/257
|
||||||
"""
|
"""
|
||||||
raise escpos.Error("This is a test.")
|
with pytest.raises(AttributeError):
|
||||||
|
raise escpos.Error("This should raise an AttributeError.")
|
||||||
|
|
||||||
|
|
||||||
|
def tests_raise_error():
|
||||||
|
"""raise error the right way"""
|
||||||
|
with pytest.raises(escpos.exceptions.Error):
|
||||||
|
raise escpos.exceptions.Error("This should raise an error.")
|
||||||
|
|
Loading…
Reference in New Issue