File: test_checksums.py

package info (click to toggle)
python-barcode 0.15.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 684 kB
  • sloc: python: 1,661; makefile: 23; sh: 9
file content (46 lines) | stat: -rwxr-xr-x 1,148 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from barcode import get_barcode


def test_code39_checksum():
    code39 = get_barcode("code39", "Code39")
    assert code39.get_fullcode() == "CODE39W"


def test_pzn_checksum():
    pzn = get_barcode("pzn", "103940")
    assert pzn.get_fullcode() == "PZN-1039406"


def test_ean13_checksum():
    ean = get_barcode("ean13", "400614457735")
    assert ean.get_fullcode() == "4006144577350"


def test_ean8_checksum():
    ean = get_barcode("ean8", "6032299")
    assert ean.get_fullcode() == "60322999"


def test_jan_checksum():
    jan = get_barcode("jan", "491400614457")
    assert jan.get_fullcode() == "4914006144575"


def test_ean14_checksum():
    ean = get_barcode("ean14", "1234567891258")
    assert ean.get_fullcode() == "12345678912589"


def test_isbn10_checksum():
    isbn = get_barcode("isbn10", "376926085")
    assert isbn.isbn10 == "3769260856"


def test_isbn13_checksum():
    isbn = get_barcode("isbn13", "978376926085")
    assert isbn.get_fullcode() == "9783769260854"


def test_gs1_128_checksum():
    gs1_128 = get_barcode("gs1_128", "00376401856400470087")
    assert gs1_128.get_fullcode() == "00376401856400470087"