Skip to content

Commit 48bbc64

Browse files
wiredfoolradarhere
andauthored
Test Typing, consistency/style issues
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
1 parent 42d0682 commit 48bbc64

7 files changed

Lines changed: 19 additions & 20 deletions

File tree

.ci/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ python3 -m pip install -U pytest-cov
3737
python3 -m pip install -U pytest-timeout
3838
python3 -m pip install pyroma
3939
# optional test dependency, only install if there's a binary package.
40-
# fails on beta 3.14 and pypy3.10
40+
# fails on beta 3.14 and PyPy
4141
python3 -m pip install --only-binary=:all: pyarrow || true
4242

4343
if [[ $(uname) != CYGWIN* ]]; then

.github/workflows/macos-install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ python3 -m pip install -U pytest-timeout
2727
python3 -m pip install pyroma
2828
python3 -m pip install numpy
2929
# optional test dependency, only install if there's a binary package.
30-
# fails on beta 3.14 and pypy3.10
30+
# fails on beta 3.14 and PyPy
3131
python3 -m pip install --only-binary=:all: pyarrow || true
3232

3333
# extra test images

Tests/test_arrow.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"mode, dest_modes",
1212
(
1313
("L", ["I", "F", "LA", "RGB", "RGBA", "RGBX", "CMYK", "YCbCr", "HSV"]),
14-
("I", ["L", "F"]), # Technically I32 can work for any 4x8bit storage.
14+
("I", ["L", "F"]), # Technically I;32 can work for any 4x8bit storage.
1515
("F", ["I", "L", "LA", "RGB", "RGBA", "RGBX", "CMYK", "YCbCr", "HSV"]),
1616
("LA", ["L", "F"]),
1717
("RGB", ["L", "F"]),
@@ -29,38 +29,38 @@ def test_invalid_array_type(mode: str, dest_modes: list[str]) -> None:
2929
Image.fromarrow(img, dest_mode, img.size)
3030

3131

32-
def test_invalid_array_size():
32+
def test_invalid_array_size() -> None:
3333
img = hopper("RGB")
3434

3535
assert img.size != (10, 10)
3636
with pytest.raises(ValueError):
3737
Image.fromarrow(img, "RGB", (10, 10))
3838

3939

40-
def test_release_schema():
40+
def test_release_schema() -> None:
4141
# these should not error out, valgrind should be clean
4242
img = hopper("L")
4343
schema = img.__arrow_c_schema__()
4444
del schema
4545

4646

47-
def test_release_array():
47+
def test_release_array() -> None:
4848
# these should not error out, valgrind should be clean
4949
img = hopper("L")
5050
array, schema = img.__arrow_c_array__()
5151
del array
5252
del schema
5353

5454

55-
def test_readonly():
55+
def test_readonly() -> None:
5656
img = hopper("L")
5757
reloaded = Image.fromarrow(img, img.mode, img.size)
5858
assert reloaded.readonly == 1
5959
reloaded._readonly = 0
6060
assert reloaded.readonly == 1
6161

6262

63-
def test_multiblock_l_image():
63+
def test_multiblock_l_image() -> None:
6464
block_size = Image.core.get_block_size()
6565

6666
# check a 2 block image in single channel mode
@@ -71,7 +71,7 @@ def test_multiblock_l_image():
7171
(schema, arr) = img.__arrow_c_array__()
7272

7373

74-
def test_multiblock_rgba_image():
74+
def test_multiblock_rgba_image() -> None:
7575
block_size = Image.core.get_block_size()
7676

7777
# check a 2 block image in 4 channel mode
@@ -82,7 +82,7 @@ def test_multiblock_rgba_image():
8282
(schema, arr) = img.__arrow_c_array__()
8383

8484

85-
def test_multiblock_l_schema():
85+
def test_multiblock_l_schema() -> None:
8686
block_size = Image.core.get_block_size()
8787

8888
# check a 2 block image in single channel mode
@@ -93,7 +93,7 @@ def test_multiblock_l_schema():
9393
img.__arrow_c_schema__()
9494

9595

96-
def test_multiblock_rgba_schema():
96+
def test_multiblock_rgba_schema() -> None:
9797
block_size = Image.core.get_block_size()
9898

9999
# check a 2 block image in 4 channel mode
@@ -104,7 +104,7 @@ def test_multiblock_rgba_schema():
104104
img.__arrow_c_schema__()
105105

106106

107-
def test_singleblock_l_image():
107+
def test_singleblock_l_image() -> None:
108108
Image.core.set_use_block_allocator(1)
109109

110110
block_size = Image.core.get_block_size()
@@ -121,7 +121,7 @@ def test_singleblock_l_image():
121121
Image.core.set_use_block_allocator(0)
122122

123123

124-
def test_singleblock_rgba_image():
124+
def test_singleblock_rgba_image() -> None:
125125
Image.core.set_use_block_allocator(1)
126126
block_size = Image.core.get_block_size()
127127

@@ -136,7 +136,7 @@ def test_singleblock_rgba_image():
136136
Image.core.set_use_block_allocator(0)
137137

138138

139-
def test_singleblock_l_schema():
139+
def test_singleblock_l_schema() -> None:
140140
Image.core.set_use_block_allocator(1)
141141
block_size = Image.core.get_block_size()
142142

@@ -150,7 +150,7 @@ def test_singleblock_l_schema():
150150
Image.core.set_use_block_allocator(0)
151151

152152

153-
def test_singleblock_rgba_schema():
153+
def test_singleblock_rgba_schema() -> None:
154154
Image.core.set_use_block_allocator(1)
155155
block_size = Image.core.get_block_size()
156156

Tests/test_pyarrow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def test_to_array(mode: str, dtype: Any, mask: Any) -> None:
7171
assert_image_equal(img, reloaded)
7272

7373

74-
def test_lifetime():
74+
def test_lifetime() -> None:
7575
# valgrind shouldn't error out here.
7676
# arrays should be accessible after the image is deleted.
7777

@@ -89,7 +89,7 @@ def test_lifetime():
8989
del arr_2
9090

9191

92-
def test_lifetime2():
92+
def test_lifetime2() -> None:
9393
# valgrind shouldn't error out here.
9494
# img should remain after the arrays are collected.
9595

src/PIL/Image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3325,7 +3325,7 @@ def fromarrow(obj: SupportsArrowArrayInterface, mode, size) -> Image:
33253325
33263326
As with array support, when converting Pillow images to arrays,
33273327
only pixel values are transferred. This means that P and PA mode
3328-
image will lose their palette.
3328+
images will lose their palette.
33293329
33303330
:param obj: Object with an arrow_c_array interface
33313331
:param mode: Image mode.

src/_imaging.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ ExportArrowArrayPyCapsule(ImagingObject *self) {
291291
return PyCapsule_New(array, "arrow_array", ReleaseArrowArrayPyCapsule);
292292
}
293293
free(array);
294-
// raise error here
295294
return ArrowError(err);
296295
}
297296

src/libImaging/Storage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ ImagingAllocateBlock(Imaging im) {
572572

573573
static void
574574
ImagingDestroyArrow(Imaging im) {
575-
// Rely on the internal python destructor for the array capsule.
575+
// Rely on the internal Python destructor for the array capsule.
576576
if (im->arrow_array_capsule) {
577577
Py_DECREF(im->arrow_array_capsule);
578578
im->arrow_array_capsule = NULL;

0 commit comments

Comments
 (0)