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_issue_3_matrix():
qr = segno.make_micro('test')
is_ok, msg = matrix_looks_valid(qr.matrix)
assert is_ok, msg
def test_create_micro():
qr = segno.make_micro('1')
assert qr.is_micro
assert 'M1' == qr.version
def test_default_border_mirco():
qr = segno.make_micro(12, version='m4')
assert 2 == qr.default_border_size
def test_plte_micro():
qr = segno.make_micro('RAIN')
dark = 'red'
buff_1 = io.BytesIO()
buff_2 = io.BytesIO()
qr.save(buff_1, kind='png', dark=dark, finder_dark=dark, alignment_dark='green')
qr.save(buff_2, kind='png', dark=dark)
assert buff_1.getvalue() == buff_2.getvalue()
def test_micro_invalid_error():
with pytest.raises(ValueError) as ex:
segno.make_micro(1, error='h')
assert 'not available' in str(ex.value)
def test_issue_3():
qr = segno.make_micro('test')
assert 'M3' == qr.version
# This fails since PNG operates with a fixed set of two colors
qr.save(io.BytesIO(), kind='png')
def test_issue_18_zero_micro():
qr = segno.make_micro(0)
assert 'M1' == qr.version
assert 'numeric' == qr.mode
assert qr.error is None
def test_plte_micro2():
qr = segno.make_micro('RAIN')
dark = 'red'
buff_1 = io.BytesIO()
buff_2 = io.BytesIO()
qr.save(buff_1, kind='png', dark=dark, finder_dark=dark, dark_module='green')
qr.save(buff_2, kind='png', dark=dark)
assert buff_1.getvalue() == buff_2.getvalue()