1
0
mirror of https://github.com/python-escpos/python-escpos synced 2025-12-02 09:43:30 +00:00

reformat codebase

This commit is contained in:
Patrick Kanzler
2021-10-30 18:15:22 +02:00
parent 109a5d8a92
commit 435f2bba24
41 changed files with 1706 additions and 1398 deletions

View File

@@ -16,13 +16,12 @@ from escpos.printer import Dummy
def get_printer():
return Dummy(magic_encode_args={'disabled': True, 'encoding': 'CP437'})
return Dummy(magic_encode_args={"disabled": True, "encoding": "CP437"})
@given(text=st.text())
def test_text(text):
"""Test that text() calls the MagicEncode object.
"""
"""Test that text() calls the MagicEncode object."""
instance = get_printer()
instance.magic.write = mock.Mock()
instance.text(text)
@@ -32,30 +31,32 @@ def test_text(text):
def test_block_text():
printer = get_printer()
printer.block_text(
"All the presidents men were eating falafel for breakfast.", font='a')
assert printer.output == \
b'All the presidents men were eating falafel\nfor breakfast.'
"All the presidents men were eating falafel for breakfast.", font="a"
)
assert (
printer.output == b"All the presidents men were eating falafel\nfor breakfast."
)
def test_textln():
printer = get_printer()
printer.textln('hello, world')
assert printer.output == b'hello, world\n'
printer.textln("hello, world")
assert printer.output == b"hello, world\n"
def test_textln_empty():
printer = get_printer()
printer.textln()
assert printer.output == b'\n'
assert printer.output == b"\n"
def test_ln():
printer = get_printer()
printer.ln()
assert printer.output == b'\n'
assert printer.output == b"\n"
def test_multiple_ln():
printer = get_printer()
printer.ln(3)
assert printer.output == b'\n\n\n'
assert printer.output == b"\n\n\n"