diff --git a/CHANGES.rst b/CHANGES.rst index b8fe39d1..1d4133d3 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,7 @@ WIP === - Added ``GappedCircleModuleDrawer`` (PIL) to render QR code modules as non-contiguous circles. (BenwestGate in `#373`_) +- Improved test coveraged (akx in `#315`_) - Migrate pyproject.toml to PEP 621-compliant [project] metadata format. (hroncok in `#399`_) - Allow execution as a Python module. (stefansjs in `#400`_) @@ -13,6 +14,7 @@ WIP python -m qrcode --output qrcode.png "hello world" +.. _#315: https://github.com/lincolnloop/python-qrcode/pull/315 .. _#373: https://github.com/lincolnloop/python-qrcode/pull/373 .. _#399: https://github.com/lincolnloop/python-qrcode/pull/399 .. _#400: https://github.com/lincolnloop/python-qrcode/pull/400 diff --git a/pyproject.toml b/pyproject.toml index 349d8a28..07236f1d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -80,3 +80,17 @@ date-format =" %%-d %%B %%Y" prereleaser.middle = [ "qrcode.release.update_manpage" ] + +[tool.coverage.run] +source = ["qrcode"] +parallel = true + +[tool.coverage.report] +exclude_lines = [ + "@abc.abstractmethod", + "@overload", + "if (typing\\.)?TYPE_CHECKING:", + "pragma: no cover", + "raise NotImplementedError" +] +skip_covered = true diff --git a/qrcode/image/styledpil.py b/qrcode/image/styledpil.py index 62cb0781..e84919d9 100644 --- a/qrcode/image/styledpil.py +++ b/qrcode/image/styledpil.py @@ -122,8 +122,7 @@ def draw_embedded_image(self): def save(self, stream, format=None, **kwargs): if format is None: format = kwargs.get("kind", self.kind) - if "kind" in kwargs: - del kwargs["kind"] + kwargs.pop("kind", None) self._img.save(stream, format=format, **kwargs) def __getattr__(self, name): diff --git a/qrcode/image/styles/moduledrawers/__init__.py b/qrcode/image/styles/moduledrawers/__init__.py index bf0df8a3..ae8b22af 100644 --- a/qrcode/image/styles/moduledrawers/__init__.py +++ b/qrcode/image/styles/moduledrawers/__init__.py @@ -1,11 +1,11 @@ # For backwards compatibility, importing the PIL drawers here. try: from .pil import CircleModuleDrawer # noqa: F401 - from .pil import GappedCircleModuleDrawer # noqa: F401 + from .pil import GappedCircleModuleDrawer # noqa: F401 from .pil import GappedSquareModuleDrawer # noqa: F401 from .pil import HorizontalBarsDrawer # noqa: F401 from .pil import RoundedModuleDrawer # noqa: F401 from .pil import SquareModuleDrawer # noqa: F401 from .pil import VerticalBarsDrawer # noqa: F401 -except ImportError: +except ImportError: # pragma: no cover pass diff --git a/qrcode/image/styles/moduledrawers/pil.py b/qrcode/image/styles/moduledrawers/pil.py index 107cf854..cd3ef83c 100644 --- a/qrcode/image/styles/moduledrawers/pil.py +++ b/qrcode/image/styles/moduledrawers/pil.py @@ -117,7 +117,9 @@ def initialize(self, *args, **kwargs): (0, 0, fake_size, fake_size), fill=self.img.paint_color ) smaller_size = int(self.size_ratio * box_size) - self.circle = self.circle.resize((smaller_size, smaller_size), Image.Resampling.LANCZOS) + self.circle = self.circle.resize( + (smaller_size, smaller_size), Image.Resampling.LANCZOS + ) def drawrect(self, box, is_active: bool): if is_active: