-
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix inconsistent EAN checksums generation
Fixes: #196
- Loading branch information
1 parent
c5fac0a
commit d804837
Showing
2 changed files
with
31 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from __future__ import annotations | ||
|
||
from barcode.ean import EAN13 | ||
|
||
|
||
def test_ean_checksum() -> None: | ||
ean = EAN13("842169142322") # input has 12 digits | ||
assert ean.calculate_checksum() == 0 | ||
|
||
ean = EAN13("8421691423220") # input has 13 digits | ||
assert ean.calculate_checksum() == 0 |