From 3962bc991f5073e2a73ba06692d490be0621c1f7 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Sun, 8 Nov 2020 22:04:27 +0100 Subject: [PATCH] improve test for soft barcode --- test/test_function_softbarcode.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/test_function_softbarcode.py b/test/test_function_softbarcode.py index fc702d7..78ae5bc 100644 --- a/test/test_function_softbarcode.py +++ b/test/test_function_softbarcode.py @@ -1,6 +1,7 @@ #!/usr/bin/python import escpos.printer as printer +import barcode.errors import pytest @@ -8,10 +9,15 @@ import pytest def instance(): 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): - instance.soft_barcode("ean8", "1234") + """test with a valid ean8 barcode""" + instance.soft_barcode("ean8", "1234567") def test_soft_barcode_ean8_nocenter(instance): - instance.soft_barcode("ean8", "1234", center=False) + instance.soft_barcode("ean8", "1234567", center=False)