diff --git a/test/unit_tests/image_stitcher_test.py b/test/unit_tests/image_stitcher_test.py index f363d8d..01f8b41 100644 --- a/test/unit_tests/image_stitcher_test.py +++ b/test/unit_tests/image_stitcher_test.py @@ -8,7 +8,7 @@ import fpdf import numpy as np import pytest from PIL import Image -from funcy import merge, second, compose, rpartial, juxt +from funcy import merge, second, compose, rpartial, juxt, rest, first from image_prediction.estimator.preprocessor.utils import image_to_normalized_tensor from image_prediction.image_extractor.extractor import ImageMetadataPair @@ -127,8 +127,8 @@ class Stitcher: def merge_group(group): - def f(pairs): - current_pair = pairs.pop(0) + + def merge_with(current_pair, pairs): to_remove = [] @@ -142,7 +142,7 @@ def merge_group(group): pairs = list(group) while True: - new_pairs = f(deepcopy(pairs)) + new_pairs = merge_with(*juxt(first, rest)(pairs)) if len(new_pairs) == len(pairs): break pairs = new_pairs