mirror of
https://github.com/python-escpos/python-escpos
synced 2025-08-24 09:03:34 +00:00
apply fixes, mainly to whitespace ( patch by @patkan in #128 )
This commit is contained in:
@@ -16,6 +16,7 @@ from nose.tools import raises
|
||||
import escpos.printer as printer
|
||||
from escpos.constants import QR_ECLEVEL_H, QR_MODEL_1
|
||||
|
||||
|
||||
def test_defaults():
|
||||
"""Test QR code with defaults"""
|
||||
instance = printer.Dummy()
|
||||
@@ -24,12 +25,14 @@ def test_defaults():
|
||||
b'(k\x07\x001P01234\x1d(k\x03\x001Q0'
|
||||
assert(instance.output == expected)
|
||||
|
||||
|
||||
def test_empty():
|
||||
"""Test QR printing blank code"""
|
||||
instance = printer.Dummy()
|
||||
instance.qr("", native=True)
|
||||
assert(instance.output == b'')
|
||||
|
||||
|
||||
def test_ec():
|
||||
"""Test QR error correction setting"""
|
||||
instance = printer.Dummy()
|
||||
@@ -38,6 +41,7 @@ def test_ec():
|
||||
b'(k\x07\x001P01234\x1d(k\x03\x001Q0'
|
||||
assert(instance.output == expected)
|
||||
|
||||
|
||||
def test_size():
|
||||
"""Test QR box size"""
|
||||
instance = printer.Dummy()
|
||||
@@ -46,6 +50,7 @@ def test_size():
|
||||
b'(k\x07\x001P01234\x1d(k\x03\x001Q0'
|
||||
assert(instance.output == expected)
|
||||
|
||||
|
||||
def test_model():
|
||||
"""Test QR model"""
|
||||
instance = printer.Dummy()
|
||||
@@ -54,24 +59,28 @@ def test_model():
|
||||
b'(k\x07\x001P01234\x1d(k\x03\x001Q0'
|
||||
assert(instance.output == expected)
|
||||
|
||||
|
||||
@raises(ValueError)
|
||||
def test_invalid_ec():
|
||||
"""Test invalid QR error correction"""
|
||||
instance = printer.Dummy()
|
||||
instance.qr("1234", native=True, ec=-1)
|
||||
|
||||
|
||||
@raises(ValueError)
|
||||
def test_invalid_size():
|
||||
"""Test invalid QR size"""
|
||||
instance = printer.Dummy()
|
||||
instance.qr("1234", native=True, size=0)
|
||||
|
||||
|
||||
@raises(ValueError)
|
||||
def test_invalid_model():
|
||||
"""Test invalid QR model"""
|
||||
instance = printer.Dummy()
|
||||
instance.qr("1234", native=True, model="Hello")
|
||||
|
||||
|
||||
def test_image():
|
||||
"""Test QR as image"""
|
||||
instance = printer.Dummy()
|
||||
@@ -82,6 +91,7 @@ def test_image():
|
||||
b'i(\x7f<\xa8A \xd8]\'\xc4]y\xf8]E\x80Ar\x94\x7fR@\x00\x00\x00'
|
||||
assert(instance.output == expected)
|
||||
|
||||
|
||||
@raises(ValueError)
|
||||
def test_image_invalid_model():
|
||||
"""Test unsupported QR model as image"""
|
||||
|
Reference in New Issue
Block a user