<reponame>mpccolorado/python-escpos<filename>test/test_raise_arbitrary_error.py
#!/usr/bin/python
"""test the raising of errors with the error module

:author: `<NAME> <<EMAIL>>`_
:organization: `python-escpos <https://github.com/python-escpos>`_
:copyright: Copyright (c) 2017 `python-escpos <https://github.com/python-escpos>`_
:license: MIT
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

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.")

#!/usr/bin/python
"""test the raising of errors with the error module

:author: `<NAME> <<EMAIL>>`_
:organization: `python-escpos <https://github.com/python-escpos>`_
:copyright: Copyright (c) 2017 `python-escpos <https://github.com/python-escpos>`_
:license: MIT
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

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.")
#!/usr/bin/python test the raising of errors with the error module  :author: `<NAME> <<EMAIL>>`_ :organization: `python-escpos <https://github.com/python-escpos>`_ :copyright: Copyright (c) 2017 `python-escpos <https://github.com/python-escpos>`_ :license: MIT raise error the wrong way      should reproduce https://github.com/python-escpos/python-escpos/issues/257 raise error the right way