Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_jump_from_m3_to_m4_dont_boost_error():
qr = segno.make('123456789012345678901234', boost_error=False)
assert 'M4-L' == qr.designator
ref_matrix = read_matrix('issue-33-m3-l-to-m4-l-jump')
assert ref_matrix == qr.matrix
def test_illegal_error_level(error):
with pytest.raises(ValueError) as ex:
segno.make(1, error=error)
assert 'illegal error correction' in str(ex.value).lower()
assert 'L, M, Q, H' in str(ex.value)
def test_symbol_size():
qr = segno.make('Hello world', micro=False)
width, height = 21, 21
border = 0
assert (width, height) == qr.symbol_size(border=border)
border = 1
assert (_calc_size(width, border) == _calc_size(width, border)), qr.symbol_size(border=border)
border = 4 # (default border)
assert (_calc_size(width, border) == _calc_size(width, border)), qr.symbol_size()
assert (_calc_size(width, border) == _calc_size(width, border)), qr.symbol_size(scale=1)
assert (_calc_size(width, border, 4), _calc_size(width, border, 4)) == qr.symbol_size(scale=4)
border = 0
assert (_calc_size(width, border, 4), _calc_size(width, border, 4)) == qr.symbol_size(border=border, scale=4)
def test_noplugin():
qr = segno.make('The Beatles')
with pytest.raises(AttributeError):
qr.to_unknown_plugin()
def test_boost_error_micro():
qr = segno.make('A', error='l')
assert qr.is_micro
assert 'M2' == qr.version
assert 'M' == qr.error
def test_version_and_error_provided2():
qr = segno.make('A' * 25, version=1) # No error level defined
assert '1-L' == qr.designator
assert 'alphanumeric' == qr.mode
def test_neq():
qr = segno.make('Hello')
qr2 = segno.make('hello')
assert qr == qr
assert qr2 == qr2
assert qr != qr2
def test_jump_from_m3_to_m4_boost_error():
qr = segno.make('123456789012345678901234')
assert 'M4-M' == qr.designator
ref_matrix = read_matrix('issue-33-m3-l-to-m4-m-jump')
assert ref_matrix == qr.matrix
def test_m1_1234(data, version):
qr = segno.make(data, version=version)
assert 'M1' == qr.designator
ref_matrix = read_matrix('issue-33-m1-1234')
assert ref_matrix == qr.matrix
////////////////////////////////////FRd7FRd7////////FRd7FRd7////////FRd7FRd7
FRd7FRd7FRd7FRd7FRd7FRd7////////////////////////////////////////////////////
////FRd7FRd7////////FRd7FRd7FRd7FRd7////////FRd7FRd7////////FRd7FRd7FRd7FRd7
////////FRd7FRd7////////FRd7FRd7FRd7FRd7////////FRd7FRd7FRd7FRd7FRd7FRd7FRd7
FRd7////////FRd7FRd7////////FRd7FRd7FRd7FRd7////////FRd7FRd7////////FRd7FRd7
FRd7FRd7////////FRd7FRd7FRd7FRd7FRd7FRd7"""
def _(s):
return s
_initial_text = _('Welcome to Segno')
generate_config = dict(boost_error=True)
output_config = dict(scale=3, dark='#000', light='#fff', border=None)
qrcode = segno.make(_initial_text)
def make_image(qr, config):
out = io.BytesIO()
try:
qr.save(out, kind='ppm', **config)
except ValueError as ex:
messagebox.showerror(_('Error'), str(ex))
return out.getvalue()
def generate_qr():
tab_name = notebook.select()
if tab_name:
page = notebook.nametowidget(tab_name)
if not page.validate():