python-escpos/test/test_abstract_base_class.py
Romain Porte 4955fe3264
drop Python 2.7 support
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.

Signed-off-by: Romain Porte <microjoe@microjoe.org>
2019-10-07 19:15:28 +02:00

27 lines
767 B
Python

#!/usr/bin/python
"""verifies that the metaclass abc is properly used by Escpos
:author: `Patrick Kanzler <patrick.kanzler@fablab.fau.de>`_
:organization: `python-escpos <https://github.com/python-escpos>`_
:copyright: Copyright (c) 2016 Patrick Kanzler
:license: MIT
"""
from nose.tools import raises
import escpos.escpos as escpos
from abc import ABCMeta
@raises(TypeError)
def test_abstract_base_class_raises():
"""test whether the abstract base class raises an exception for Escpos"""
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