File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33from barcode .ean import EAN13
44
55
6- def test_ean_checksum () -> None :
7- ean = EAN13 ("842169142322" ) # input has 12 digits
8- assert ean .calculate_checksum () == 0
6+ def test_ean_checksum_generated () -> None :
7+ ean = EAN13 ("842167143322" ) # input has 12 digits
8+ assert ean .calculate_checksum () == 5
9+ assert ean .ean == "8421671433225"
910
10- ean = EAN13 ("8421691423220" ) # input has 13 digits
11- assert ean .calculate_checksum () == 0
11+
12+ def test_ean_checksum_zeroed () -> None :
13+ ean = EAN13 ("842167143322" , no_checksum = True ) # input has 12 digits
14+ assert ean .calculate_checksum () == 5
15+ assert ean .ean == "8421671433220"
16+
17+
18+ def test_ean_checksum_supplied_and_generated () -> None :
19+ ean = EAN13 ("8421671433225" ) # input has 13 digits
20+ assert ean .calculate_checksum () == 5
21+ assert ean .ean == "8421671433225"
You can’t perform that action at this time.
0 commit comments