MCPcopy Create free account
hub / github.com/Mercury7353/PyBench / test_task_83

Function test_task_83

data/unit_test/tests.py:825–849  ·  view source on GitHub ↗
(trajectory)

Source from the content-addressed store, hash-verified

823 assert are_two_images_same(rotated_image,ref_image)
824
825def test_task_83(trajectory):
826 image_paths = ["./output/83_1.png", "./output/83_2.png", "./output/83_3.png", "./output/83_4.png"]
827 ref_path = "./data/83.jpeg"
828
829 # 打开参考图片
830 ref_image = Image.open(ref_path)
831
832 # 打开并拼接四张图片
833 images = [Image.open(path) for path in image_paths]
834 widths, heights = zip(*(img.size for img in images))
835
836 total_width = sum(widths)
837 max_height = max(heights)
838
839 # 创建一个新的空白图像用于拼接
840 new_image = Image.new('RGB', (total_width, max_height))
841
842 # 将四张图片拼接到新图像上
843 x_offset = 0
844 for img in images:
845 new_image.paste(img, (x_offset, 0))
846 x_offset += img.width
847
848 # 比较拼接后的图像与参考图像的尺寸比例
849 assert is_proportionally_similar(new_image, ref_image), "The concatenated image is not proportionally similar to the reference image."
850
851def test_task_83(trajectory):
852 image_paths = ["./output/83_1.png", "./output/83_2.png", "./output/83_3.png", "./output/83_4.png"]

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected