From 70d0279cb9f3c056271601a0009ba5487af42efa Mon Sep 17 00:00:00 2001 From: profitroll Date: Thu, 10 Aug 2023 14:31:33 +0200 Subject: [PATCH] Fixed -p and improved coverage --- README.md | 5 ++-- tests/{test_500x500.py => test_generator.py} | 26 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) rename tests/{test_500x500.py => test_generator.py} (71%) diff --git a/README.md b/README.md index b2ab0f9..6d0fd35 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ pip install --index-url https://git.end-play.xyz/api/packages/profitroll/pypi/si ## Usage ```example -usage: huepaper [-h] [--width WIDTH] [--height HEIGHT] [-c COLOR] [-np] [-o OUTPUT] [-l [LINES]] [-lb [LINES_BRIGHT]] [-ld [LINES_DARK]] [-P [PIXELATE]] [-e EMBLEM] [-hue HUE] [-smin SMIN] [-smax SMAX] [-lmin LMIN] [-lmax LMAX] +usage: huepaper [-h] [--width WIDTH] [--height HEIGHT] [-c COLOR] [-np] [-o OUTPUT] [-l [LINES]] [-lb [LINES_BRIGHT]] [-ld [LINES_DARK]] [-p [PIXELATE]] [-e EMBLEM] [-hue HUE] [-smin SMIN] [-smax SMAX] [-lmin LMIN] [-lmax LMAX] Create wallpapers based on color hues. @@ -28,7 +28,6 @@ optional arguments: --height HEIGHT height of the image (default: 1080) -c COLOR, --color COLOR base color from which the huepaper is generated (default: random color) - -np, --no-preview don't preview the huepaper -o OUTPUT, --output OUTPUT filepath where the huepaper will be saved -l [LINES], --lines [LINES] @@ -116,7 +115,7 @@ huepaper -hue 1.0 -lmin 0.3 -lmax 0.6 -smin 0.8 -smax 1.0 ![Huepaper 5](images/huepaper_5.png) ``` example -huepaper -hue 0.3 -lmin 0.5 -lmax 0.5 -l 0.5 -P 64x36 +huepaper -hue 0.3 -lmin 0.5 -lmax 0.5 -l 0.5 -p 64x36 ``` ------------------------------------------------------------------------ diff --git a/tests/test_500x500.py b/tests/test_generator.py similarity index 71% rename from tests/test_500x500.py rename to tests/test_generator.py index f65266c..4cffda5 100644 --- a/tests/test_500x500.py +++ b/tests/test_generator.py @@ -1,5 +1,6 @@ from os import remove from pathlib import Path +from subprocess import run from PIL.Image import Image @@ -28,6 +29,31 @@ def test_saving(): remove(Path("tests/image.jpg")) +def test_shell(): + assert ( + run( + [ + "huepaper", + "-hue", + "0.3", + "-lmin", + "0.5", + "-lmax", + "0.3", + "-l", + "0.5", + "-p", + "64x36", + "-o", + "tests/image.jpg", + ], + check=False, + ).returncode + == 0 + ) + remove(Path("tests/image.jpg")) + + def test_generation_example_1(): image = generate(color="lightgreen") assert isinstance(image, Image)