mirror of
https://github.com/python-pillow/Pillow.git
synced 2026-02-03 22:15:52 +03:00
Merge branch 'main' into msys
This commit is contained in:
commit
dbcfdd5454
|
|
@ -1,10 +1,11 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from io import BytesIO
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImagePalette
|
||||
from PIL import Image, ImagePalette, PaletteFile
|
||||
|
||||
from .helper import assert_image_equal, assert_image_equal_tofile
|
||||
|
||||
|
|
@ -202,6 +203,19 @@ def test_2bit_palette(tmp_path: Path) -> None:
|
|||
assert_image_equal_tofile(img, outfile)
|
||||
|
||||
|
||||
def test_getpalette() -> None:
|
||||
b = BytesIO(b"0 1\n1 2 3 4")
|
||||
p = PaletteFile.PaletteFile(b)
|
||||
|
||||
palette, rawmode = p.getpalette()
|
||||
assert palette[:6] == b"\x01\x01\x01\x02\x03\x04"
|
||||
assert rawmode == "RGB"
|
||||
|
||||
|
||||
def test_invalid_palette() -> None:
|
||||
with pytest.raises(OSError):
|
||||
ImagePalette.load("Tests/images/hopper.jpg")
|
||||
|
||||
b = BytesIO(b"1" * 101)
|
||||
with pytest.raises(SyntaxError, match="bad palette file"):
|
||||
PaletteFile.PaletteFile(b)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ These platforms are built and tested for every change.
|
|||
| Windows Server 2025 | 3.11, 3.12, 3.13, 3.14, | x86-64 |
|
||||
| | PyPy3 | |
|
||||
| +----------------------------+---------------------+
|
||||
| | 3.12 (CLANG64, MINGW64) | x86-64 |
|
||||
| | 3.13 (CLANG64, MINGW64) | x86-64 |
|
||||
+----------------------------------+----------------------------+---------------------+
|
||||
|
||||
|
||||
|
|
|
|||
6
setup.py
6
setup.py
|
|
@ -1089,7 +1089,11 @@ ext_modules = [
|
|||
Extension("PIL._webp", ["src/_webp.c"]),
|
||||
Extension("PIL._avif", ["src/_avif.c"]),
|
||||
Extension("PIL._imagingtk", ["src/_imagingtk.c", "src/Tk/tkImaging.c"]),
|
||||
Extension("PIL._imagingmath", ["src/_imagingmath.c"]),
|
||||
Extension(
|
||||
"PIL._imagingmath",
|
||||
["src/_imagingmath.c"],
|
||||
libraries=None if sys.platform == "win32" else ["m"],
|
||||
),
|
||||
Extension("PIL._imagingmorph", ["src/_imagingmorph.c"]),
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user