2018-05-14 23:03:07 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
import escpos.printer as printer
|
2020-11-08 21:04:27 +00:00
|
|
|
import barcode.errors
|
2018-05-14 23:03:07 +00:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
2020-05-10 12:05:33 +00:00
|
|
|
@pytest.fixture
|
|
|
|
def instance():
|
|
|
|
return printer.Dummy()
|
|
|
|
|
2020-11-08 21:04:27 +00:00
|
|
|
def test_soft_barcode_ean8_invalid(instance):
|
|
|
|
"""test with an invalid barcode"""
|
|
|
|
with pytest.raises(barcode.errors.BarcodeError):
|
|
|
|
instance.soft_barcode("ean8", "1234")
|
2020-05-10 12:05:33 +00:00
|
|
|
|
|
|
|
def test_soft_barcode_ean8(instance):
|
2020-11-08 21:04:27 +00:00
|
|
|
"""test with a valid ean8 barcode"""
|
|
|
|
instance.soft_barcode("ean8", "1234567")
|
2018-05-14 23:03:07 +00:00
|
|
|
|
2020-05-10 12:06:00 +00:00
|
|
|
|
|
|
|
def test_soft_barcode_ean8_nocenter(instance):
|
2020-11-08 21:04:27 +00:00
|
|
|
instance.soft_barcode("ean8", "1234567", center=False)
|