исправление бага с картинкой

This commit is contained in:
kaktuz20000
2026-11-06 08:56:23 +03:00
parent dd098ac0a3
commit edbde72f4b
3 changed files with 53 additions and 15 deletions
+15
View File
@@ -38,6 +38,21 @@ def main():
assert by_name["thumbnail"]["sha256"] != {
item["name"]: item for item in newer
}["thumbnail"]["sha256"]
odd_ratio = io.BytesIO()
Image.new("RGB", (319, 200), "blue").save(odd_ratio, format="PNG")
odd_variants = {
item["name"]: item for item in build_variants(attachment_id, odd_ratio.getvalue())
}
assert (odd_variants["thumbnail"]["width"], odd_variants["thumbnail"]["height"]) == (256, 160)
small_image = io.BytesIO()
Image.new("RGB", (100, 50), "red").save(small_image, format="PNG")
small_variants = {
item["name"]: item for item in build_variants(attachment_id, small_image.getvalue())
}
assert (small_variants["thumbnail"]["width"], small_variants["thumbnail"]["height"]) == (100, 50)
assert (small_variants["optimized"]["width"], small_variants["optimized"]["height"]) == (100, 50)
print("PASS: versioned thumbnail, crop, and optimized variants match dimensions and checksums")