improve test for soft barcode

This commit is contained in:
Patrick Kanzler 2020-11-08 22:04:27 +01:00
parent b608d59942
commit 3962bc991f
1 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
import escpos.printer as printer import escpos.printer as printer
import barcode.errors
import pytest import pytest
@ -8,10 +9,15 @@ import pytest
def instance(): def instance():
return printer.Dummy() return printer.Dummy()
def test_soft_barcode_ean8_invalid(instance):
"""test with an invalid barcode"""
with pytest.raises(barcode.errors.BarcodeError):
instance.soft_barcode("ean8", "1234")
def test_soft_barcode_ean8(instance): def test_soft_barcode_ean8(instance):
instance.soft_barcode("ean8", "1234") """test with a valid ean8 barcode"""
instance.soft_barcode("ean8", "1234567")
def test_soft_barcode_ean8_nocenter(instance): def test_soft_barcode_ean8_nocenter(instance):
instance.soft_barcode("ean8", "1234", center=False) instance.soft_barcode("ean8", "1234567", center=False)