
Python 2.7 EOL is arriving on 2020-01-01: https://pythonclock.org/ This will allow us to use Python 3 only libraries, like python-barcode, which can maintain a reduced, simpler codebase, due to only one version to support. Closes #371. Signed-off-by: Romain Porte <microjoe@microjoe.org>
29 lines
797 B
Python
29 lines
797 B
Python
#!/usr/bin/python
|
|
"""test the raising of errors with the error module
|
|
|
|
:author: `Patrick Kanzler <patrick.kanzler@fablab.fau.de>`_
|
|
:organization: `python-escpos <https://github.com/python-escpos>`_
|
|
:copyright: Copyright (c) 2017 `python-escpos <https://github.com/python-escpos>`_
|
|
:license: MIT
|
|
"""
|
|
|
|
|
|
import pytest
|
|
import escpos
|
|
import escpos.exceptions
|
|
|
|
|
|
def test_raise_error_wrongly():
|
|
"""raise error the wrong way
|
|
|
|
should reproduce https://github.com/python-escpos/python-escpos/issues/257
|
|
"""
|
|
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.")
|