kumquat-buildroot/support/testing/tests/package/sample_python_segno.py
Witold Lipieta 7412789bfd package/python-segno: new package
segno 1.5.2 https://pypi.org/project/segno/

Signed-off-by: Witold Lipieta <witold.lipieta@thaumatec.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2023-08-24 23:43:28 +02:00

14 lines
339 B
Python

import segno
import os
import tempfile
qr = segno.make_qr('http:/www.example.org/')
with tempfile.NamedTemporaryFile('wb', suffix='.png', delete=False) as f:
fn = f.name
qr.save(fn)
expected = b'\211PNG\r\n\032\n' # PNG magic number
with open(fn, mode='rb') as f:
val = f.read(len(expected))
os.unlink(fn)
assert expected == val