From 50ad227bd5188ca651713904b5ae83fd8580b2f8 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 18 May 2023 11:19:35 +0200 Subject: [PATCH] Refactorise le script Python avec une convention --- src/test_images.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/test_images.py b/src/test_images.py index 068b757..cfa149f 100644 --- a/src/test_images.py +++ b/src/test_images.py @@ -7,7 +7,7 @@ import os import pytest -def validate_brightness_image(working_path, theme_config, high_light, image_list, brightness_way): +def _validate_brightness_image(working_path, theme_config, high_light, image_list, brightness_way): image_pattern = theme_config.get("imageFilename") image_filenames = {}.fromkeys(glob.glob(str(Path(working_path, image_pattern)))) # generate an image statistics for each images @@ -15,6 +15,7 @@ def validate_brightness_image(working_path, theme_config, high_light, image_list this_image = Image.open(an_imagefile).convert("L") this_image_stats = ImageStat.Stat(this_image) image_filenames[an_imagefile] = this_image_stats.mean[0] + #print(f'{an_imagefile} : {image_filenames[an_imagefile]}') # get the brightest observed image from the list if high_light == "dayHighlight": @@ -54,11 +55,11 @@ def manifest(working_path): def test_brightest_image(working_path, manifest): - validate_brightness_image(working_path, manifest, "dayHighlight", "dayImageList", "Brightest") + _validate_brightness_image(working_path, manifest, "dayHighlight", "dayImageList", "Brightest") def test_darkest_image(working_path, manifest): - validate_brightness_image(working_path, manifest, "nightHighlight", "nightImageList", "Darkest") + _validate_brightness_image(working_path, manifest, "nightHighlight", "nightImageList", "Darkest") def test_image_size(working_path, manifest):