mirror of
https://github.com/python-escpos/python-escpos
synced 2025-09-13 09:09:58 +00:00
Port to current version of escpos-printer-db.
This commit is contained in:
@@ -12,23 +12,29 @@ from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
import mock
|
||||
from hypothesis import given
|
||||
from hypothesis import given, assume
|
||||
import hypothesis.strategies as st
|
||||
from escpos.printer import Dummy
|
||||
|
||||
|
||||
def get_printer():
|
||||
return Dummy(magic_encode_args={'disabled': True, 'encoding': 'cp437'})
|
||||
|
||||
|
||||
@given(text=st.text())
|
||||
def test_function_text_dies_ist_ein_test_lf(text):
|
||||
"""test the text printing function with simple string and compare output"""
|
||||
instance = Dummy()
|
||||
instance.magic.encode_text = mock.Mock()
|
||||
def test_text(text):
|
||||
"""Test that text() calls the MagicEncode object.
|
||||
"""
|
||||
instance = get_printer()
|
||||
instance.magic.write = mock.Mock()
|
||||
instance.text(text)
|
||||
instance.magic.encode_text.assert_called_with(txt=text)
|
||||
instance.magic.write.assert_called_with(text)
|
||||
|
||||
|
||||
def test_block_text():
|
||||
printer = Dummy()
|
||||
printer = get_printer()
|
||||
printer.block_text(
|
||||
"All the presidents men were eating falafel for breakfast.", font='a')
|
||||
assert printer.output == \
|
||||
|
Reference in New Issue
Block a user