Skip to content

Commit da2c542

Browse files
committed
Add tests for EAN checksum calculation
Closes: #215
1 parent 996eaf9 commit da2c542

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tests/test_ean.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from __future__ import annotations
2+
3+
from barcode.ean import EAN13
4+
5+
6+
def test_ean_checksum() -> None:
7+
ean = EAN13("842169142322") # input has 12 digits
8+
assert ean.calculate_checksum() == 0
9+
10+
ean = EAN13("8421691423220") # input has 13 digits
11+
assert ean.calculate_checksum() == 0

0 commit comments

Comments
 (0)