2016-04-03 20:16:03 +00:00
|
|
|
#!/usr/bin/python
|
2020-05-11 21:39:56 +00:00
|
|
|
"""verifies that the metaclass abc is properly used by ESC/POS
|
2016-04-03 20:16:03 +00:00
|
|
|
|
|
|
|
:author: `Patrick Kanzler <patrick.kanzler@fablab.fau.de>`_
|
|
|
|
:organization: `python-escpos <https://github.com/python-escpos>`_
|
|
|
|
:copyright: Copyright (c) 2016 Patrick Kanzler
|
2017-01-29 23:39:43 +00:00
|
|
|
:license: MIT
|
2016-04-03 20:16:03 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
from nose.tools import raises
|
|
|
|
|
|
|
|
import escpos.escpos as escpos
|
|
|
|
from abc import ABCMeta
|
|
|
|
|
|
|
|
|
|
|
|
@raises(TypeError)
|
|
|
|
def test_abstract_base_class_raises():
|
2020-05-11 21:39:56 +00:00
|
|
|
"""test whether the abstract base class raises an exception for ESC/POS"""
|
2016-04-03 20:16:03 +00:00
|
|
|
escpos.Escpos() # This call should raise TypeError because of abstractmethod _raw()
|
|
|
|
|
|
|
|
|
|
|
|
def test_abstract_base_class():
|
|
|
|
""" test whether Escpos has the metaclass ABCMeta """
|
|
|
|
assert issubclass(escpos.Escpos, object)
|
|
|
|
assert type(escpos.Escpos) is ABCMeta
|