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
|
|
|
|
2023-08-14 23:03:36 +00:00
|
|
|
:author: `Patrick Kanzler <dev@pkanzler.de>`_
|
2016-04-03 20:16:03 +00:00
|
|
|
: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
|
|
|
"""
|
|
|
|
|
2023-08-14 23:03:36 +00:00
|
|
|
from abc import ABCMeta
|
|
|
|
|
2023-08-09 22:18:02 +00:00
|
|
|
import pytest
|
2023-08-14 23:03:36 +00:00
|
|
|
|
2016-04-03 20:16:03 +00:00
|
|
|
import escpos.escpos as escpos
|
|
|
|
|
|
|
|
|
2023-12-17 00:15:59 +00:00
|
|
|
def test_abstract_base_class_raises() -> None:
|
2020-05-11 21:39:56 +00:00
|
|
|
"""test whether the abstract base class raises an exception for ESC/POS"""
|
2023-08-09 22:18:02 +00:00
|
|
|
with pytest.raises(TypeError):
|
|
|
|
# This call should raise TypeError because of abstractmethod _raw()
|
2023-12-17 00:15:59 +00:00
|
|
|
escpos.Escpos() # type: ignore [abstract]
|
2016-04-03 20:16:03 +00:00
|
|
|
|
|
|
|
|
2023-12-17 00:15:59 +00:00
|
|
|
def test_abstract_base_class() -> None:
|
2021-10-30 16:15:22 +00:00
|
|
|
"""test whether Escpos has the metaclass ABCMeta"""
|
2016-04-03 20:16:03 +00:00
|
|
|
assert issubclass(escpos.Escpos, object)
|
|
|
|
assert type(escpos.Escpos) is ABCMeta
|