From 169431937df2fedc321e9ef67a5206eb3d324427 Mon Sep 17 00:00:00 2001 From: Lars Date: Mon, 27 Nov 2023 11:59:24 +0100 Subject: [PATCH] Added test case for issue #12 --- noxfile.py | 3 ++- requirements-testing.txt | 1 + tests/test_to_artistic.py | 21 +++++++++++++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index 52e5240..7619ca2 100644 --- a/noxfile.py +++ b/noxfile.py @@ -8,6 +8,7 @@ """\ Nox test runner configuration. """ +import sys import os import re from functools import partial @@ -16,7 +17,7 @@ import nox _PY_VERSIONS = ('3.7', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3') -_PY_DEFAULT_VERSION = '3.11' +_PY_DEFAULT_VERSION = sys.version[:4] nox.options.sessions = ['test-{}'.format(_PY_DEFAULT_VERSION), 'test-pypy3'] diff --git a/requirements-testing.txt b/requirements-testing.txt index 8070e79..9c8fd8c 100644 --- a/requirements-testing.txt +++ b/requirements-testing.txt @@ -3,3 +3,4 @@ pytest pyzbar~=0.1.8 cairosvg +setuptools diff --git a/tests/test_to_artistic.py b/tests/test_to_artistic.py index 000f0e4..7d85dc9 100644 --- a/tests/test_to_artistic.py +++ b/tests/test_to_artistic.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2016 - 2020 -- Lars Heuer - Semagia . +# Copyright (c) 2016 - 2023 -- Lars Heuer - Semagia . # All rights reserved. # # License: BSD License @@ -8,7 +8,6 @@ """\ Tests against QRCode.to_artistic """ -from __future__ import absolute_import import os import io import tempfile @@ -169,6 +168,24 @@ def test_issue_11(): os.remove(fn) +def test_issue_12(): + # https://github.com/heuer/qrcode-artistic/pull/12 + content = 'Penny Lane' + out = io.BytesIO() + img_src = _img_src('animated.gif') + org_img = Image.open(img_src) + assert org_img.is_animated + assert org_img.n_frames > 1 + qr = segno.make_qr(content) + assert qr + qr.to_artistic(img_src, out, kind='gif') + out.seek(0) + res_img = Image.open(out) + assert res_img.is_animated + assert org_img.n_frames == res_img.n_frames + assert org_img.info.get('loop', 0) == res_img.info.get('loop', 0) + + @pytest.mark.skipif(_PYTHON2, reason='Requires Python >= 3.6') def test_svg_to_png(): content = "Ring my friend I said you'd call"