Replace print with assert (#9171)

This commit is contained in:
Hugo van Kemenade 2025-08-22 13:14:15 +03:00 committed by GitHub
commit 97a4d1f593
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -28,15 +28,13 @@ def test_numpy_to_image() -> None:
a = numpy.array(data, dtype=dtype)
a.shape = TEST_IMAGE_SIZE
i = Image.fromarray(a)
if list(i.getdata()) != data:
print("data mismatch for", dtype)
assert list(i.getdata()) == data
else:
data = list(range(100))
a = numpy.array([[x] * bands for x in data], dtype=dtype)
a.shape = TEST_IMAGE_SIZE[0], TEST_IMAGE_SIZE[1], bands
i = Image.fromarray(a)
if list(i.getchannel(0).getdata()) != list(range(100)):
print("data mismatch for", dtype)
assert list(i.getchannel(0).getdata()) == list(range(100))
return i
# Check supported 1-bit integer formats