コード例 #1
0
ファイル: test_properties.py プロジェクト: xloem/pyzint
def test_all():
    option_1 = 0
    option_2 = 0
    option_3 = 0
    scale = 9.76
    show_text = False
    fontsize = 10
    height = 74
    whitespace_width = 2
    border_width = 3
    eci = 4
    primary = "foo"
    text = "bar"
    dot_size = 5

    z = zint.Zint(
        "[255]11111111111222",
        zint.BARCODE_RSS_EXP,
        option_1,
        option_2,
        option_3,
        scale=scale,
        show_text=show_text,
        fontsize=fontsize,
        height=height,
        whitespace_width=whitespace_width,
        border_width=border_width,
        eci=eci,
        text=text,
        primary=primary,
        dot_size=dot_size,
    )

    assert z.data == "[255]11111111111222"
    assert z.option_1 == option_1
    assert z.option_2 == option_2
    assert z.option_3 == option_3

    assert z.scale == pytest.approx(scale)
    assert z.fontsize == fontsize
    assert z.height == height
    assert z.whitespace_width == whitespace_width
    assert z.border_width == border_width
    assert z.show_text == show_text
    assert z.eci == eci
    assert z.text == text
    assert z.primary == primary
    assert z.dot_size == dot_size
コード例 #2
0
ファイル: test_locale.py プロジェクト: Pavkazzz/pyzint
def test_ru_locale_svg():
    locale.setlocale(locale.LC_NUMERIC, "ru_RU.utf8")
    barcode = zint.Zint("test", zint.BARCODE_AZTEC, height=200, border_width=4)
    assert "," not in barcode.render_svg().decode()
コード例 #3
0
ファイル: test_properties.py プロジェクト: xloem/pyzint
def test_option_3():
    z = zint.Zint("Barcode", zint.BARCODE_QRCODE)
    assert z.option_3 == 0
コード例 #4
0
ファイル: test_properties.py プロジェクト: xloem/pyzint
def test_option_1():
    z = zint.Zint("Barcode", zint.BARCODE_QRCODE)
    # See https://github.com/Pavkazzz/zint/blob/master/backend/library.c#L62
    assert z.option_1 == -1
コード例 #5
0
ファイル: test_properties.py プロジェクト: xloem/pyzint
def test_height():
    z = zint.Zint("Barcode", zint.BARCODE_QRCODE)
    assert z.height == 50
コード例 #6
0
ファイル: test_properties.py プロジェクト: xloem/pyzint
def test_fontsize():
    z = zint.Zint("Barcode", zint.BARCODE_QRCODE)
    assert z.fontsize == 8
コード例 #7
0
ファイル: test_properties.py プロジェクト: xloem/pyzint
def test_eci():
    z = zint.Zint("Barcode", zint.BARCODE_QRCODE)
    assert z.eci == 0
コード例 #8
0
ファイル: test_properties.py プロジェクト: xloem/pyzint
def test_dot_size():
    z = zint.Zint("Barcode", zint.BARCODE_QRCODE)
    assert z.dot_size == pytest.approx(0.8)
コード例 #9
0
ファイル: test_properties.py プロジェクト: xloem/pyzint
def test_data():
    z = zint.Zint("Barcode", zint.BARCODE_QRCODE)
    assert z.data == "Barcode"
コード例 #10
0
ファイル: test_properties.py プロジェクト: xloem/pyzint
def test_border_width():
    z = zint.Zint("Barcode", zint.BARCODE_QRCODE)
    assert z.border_width == 0
コード例 #11
0
ファイル: test_properties.py プロジェクト: xloem/pyzint
def test_text():
    z = zint.Zint("Barcode", zint.BARCODE_QRCODE)
    assert z.text is None
コード例 #12
0
ファイル: test_properties.py プロジェクト: xloem/pyzint
def test_symbology_name():
    z = zint.Zint("Barcode", zint.BARCODE_QRCODE)
    assert z.symbology_name == "qrcode"
コード例 #13
0
ファイル: test_properties.py プロジェクト: xloem/pyzint
def test_symbology():
    z = zint.Zint("Barcode", zint.BARCODE_QRCODE)
    assert z.symbology == zint.BARCODE_QRCODE
コード例 #14
0
ファイル: test_properties.py プロジェクト: xloem/pyzint
def test_show_text():
    z = zint.Zint("Barcode", zint.BARCODE_QRCODE)
    assert z.show_text is True
コード例 #15
0
ファイル: test_properties.py プロジェクト: xloem/pyzint
def test_scale():
    z = zint.Zint("Barcode", zint.BARCODE_QRCODE)
    assert z.scale == 1.0
コード例 #16
0
ファイル: test_properties.py プロジェクト: xloem/pyzint
def test_primary():
    z = zint.Zint("Barcode", zint.BARCODE_QRCODE)
    assert z.primary is None