Skip to content

Commit

Permalink
Added test case
Browse files Browse the repository at this point in the history
  • Loading branch information
heuer committed Aug 16, 2016
1 parent 6c331b3 commit 7173587
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This package implements main parts of ISO/IEC 18004:2006(E) / ISO/IEC 18004:2015
and produces Micro QR Codes and QR Codes with nearly no effort.

Segno provides several serialization formats like SVG, EPS, PNG, PDF, or text
output. Neither of these serializers require an external lib. Segno provides
output. None of these serializers require an external lib. Segno provides
more serialization formats via a plugin architecture. It was tested against
Python 2.6 - 3.4 and PyPy.

Expand Down
10 changes: 10 additions & 0 deletions tests/test_qrcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,16 @@ def test_neq():
ok_(qr != qr2)


def test_save_png_buffer():
qr = segno.make_qr('test')
out = io.BytesIO()
qr.save(out, kind='png')
out.seek(0)
expected = b'\211PNG\r\n\032\n' # PNG magic number
val = out.read(len(expected))
eq_(expected, val)


def test_save_png_filestream():
qr = segno.make_qr('test')
f = tempfile.NamedTemporaryFile('wb', suffix='.png', delete=False)
Expand Down

0 comments on commit 7173587

Please sign in to comment.