Skip to content

Commit

Permalink
Run ruf and fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
maribedran committed Sep 26, 2024
1 parent 137946a commit 5760eec
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 32 deletions.
4 changes: 2 additions & 2 deletions TESTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ If you want, you can test against a specific version like this: ``tox -e py312-p
Linting
-------

Run `ruff` to check linting::
Run `ruff` to check formatting::

ruff check
ruff format qrcode
64 changes: 34 additions & 30 deletions qrcode/tests/test_qrcode_pil.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,17 @@ def test_render_styled_with_embeded_image_path(tmp_path):
img.save(io.BytesIO())


@pytest.mark.parametrize("drawer", [
moduledrawers.CircleModuleDrawer,
moduledrawers.GappedSquareModuleDrawer,
moduledrawers.HorizontalBarsDrawer,
moduledrawers.RoundedModuleDrawer,
moduledrawers.SquareModuleDrawer,
moduledrawers.VerticalBarsDrawer,
])
@pytest.mark.parametrize(
"drawer",
[
moduledrawers.CircleModuleDrawer,
moduledrawers.GappedSquareModuleDrawer,
moduledrawers.HorizontalBarsDrawer,
moduledrawers.RoundedModuleDrawer,
moduledrawers.SquareModuleDrawer,
moduledrawers.VerticalBarsDrawer,
],
)
def test_render_styled_with_drawer(drawer):
qr = qrcode.QRCode(error_correction=qrcode.ERROR_CORRECT_L)
qr.add_data(UNICODE_TEXT)
Expand All @@ -84,28 +87,29 @@ def test_render_styled_with_drawer(drawer):
img.save(io.BytesIO())


@pytest.mark.parametrize("mask", [
colormasks.SolidFillColorMask(),
colormasks.SolidFillColorMask(back_color=WHITE, front_color=RED),
colormasks.SolidFillColorMask(
back_color=(255, 0, 255, 255), front_color=RED
),
colormasks.RadialGradiantColorMask(
back_color=WHITE, center_color=BLACK, edge_color=RED
),
colormasks.SquareGradiantColorMask(
back_color=WHITE, center_color=BLACK, edge_color=RED
),
colormasks.HorizontalGradiantColorMask(
back_color=WHITE, left_color=RED, right_color=BLACK
),
colormasks.VerticalGradiantColorMask(
back_color=WHITE, top_color=RED, bottom_color=BLACK
),
colormasks.ImageColorMask(
back_color=WHITE, color_mask_image=Image.new("RGB", (10, 10), color="red")
),
])
@pytest.mark.parametrize(
"mask",
[
colormasks.SolidFillColorMask(),
colormasks.SolidFillColorMask(back_color=WHITE, front_color=RED),
colormasks.SolidFillColorMask(back_color=(255, 0, 255, 255), front_color=RED),
colormasks.RadialGradiantColorMask(
back_color=WHITE, center_color=BLACK, edge_color=RED
),
colormasks.SquareGradiantColorMask(
back_color=WHITE, center_color=BLACK, edge_color=RED
),
colormasks.HorizontalGradiantColorMask(
back_color=WHITE, left_color=RED, right_color=BLACK
),
colormasks.VerticalGradiantColorMask(
back_color=WHITE, top_color=RED, bottom_color=BLACK
),
colormasks.ImageColorMask(
back_color=WHITE, color_mask_image=Image.new("RGB", (10, 10), color="red")
),
],
)
def test_render_styled_with_mask(mask):
qr = qrcode.QRCode(error_correction=qrcode.ERROR_CORRECT_L)
qr.add_data(UNICODE_TEXT)
Expand Down

0 comments on commit 5760eec

Please sign in to comment.