mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-04-27 20:43:43 +03:00
Merge pull request #3725 from jdufresne/bytes-warning
Fix BytesWarning in Tests/test_numpy.py
This commit is contained in:
commit
b261773fb8
|
@ -115,7 +115,7 @@ class TestNumpy(PillowTestCase):
|
||||||
arr_back = numpy.array(img)
|
arr_back = numpy.array(img)
|
||||||
# numpy 1.8 and earlier return this as a boolean. (trusty/precise)
|
# numpy 1.8 and earlier return this as a boolean. (trusty/precise)
|
||||||
if arr_back.dtype == numpy.bool:
|
if arr_back.dtype == numpy.bool:
|
||||||
arr_bool = numpy.array([[1, 0, 0, 1, 0], [0, 1, 0, 0, 0]], 'bool')
|
arr_bool = numpy.array([[1, 0, 0, 1, 0], [0, 1, 0, 0, 0]], numpy.bool)
|
||||||
numpy.testing.assert_array_equal(arr_bool, arr_back)
|
numpy.testing.assert_array_equal(arr_bool, arr_back)
|
||||||
else:
|
else:
|
||||||
numpy.testing.assert_array_equal(arr, arr_back)
|
numpy.testing.assert_array_equal(arr, arr_back)
|
||||||
|
@ -143,21 +143,21 @@ class TestNumpy(PillowTestCase):
|
||||||
|
|
||||||
np_img = numpy.array(img)
|
np_img = numpy.array(img)
|
||||||
self._test_img_equals_nparray(img, np_img)
|
self._test_img_equals_nparray(img, np_img)
|
||||||
self.assertEqual(np_img.dtype, numpy.dtype(dtype))
|
self.assertEqual(np_img.dtype, dtype)
|
||||||
|
|
||||||
modes = [("L", 'uint8'),
|
modes = [("L", numpy.uint8),
|
||||||
("I", 'int32'),
|
("I", numpy.int32),
|
||||||
("F", 'float32'),
|
("F", numpy.float32),
|
||||||
("LA", 'uint8'),
|
("LA", numpy.uint8),
|
||||||
("RGB", 'uint8'),
|
("RGB", numpy.uint8),
|
||||||
("RGBA", 'uint8'),
|
("RGBA", numpy.uint8),
|
||||||
("RGBX", 'uint8'),
|
("RGBX", numpy.uint8),
|
||||||
("CMYK", 'uint8'),
|
("CMYK", numpy.uint8),
|
||||||
("YCbCr", 'uint8'),
|
("YCbCr", numpy.uint8),
|
||||||
("I;16", '<u2'),
|
("I;16", '<u2'),
|
||||||
("I;16B", '>u2'),
|
("I;16B", '>u2'),
|
||||||
("I;16L", '<u2'),
|
("I;16L", '<u2'),
|
||||||
("HSV", 'uint8'),
|
("HSV", numpy.uint8),
|
||||||
]
|
]
|
||||||
|
|
||||||
for mode in modes:
|
for mode in modes:
|
||||||
|
@ -167,7 +167,7 @@ class TestNumpy(PillowTestCase):
|
||||||
# see https://github.com/python-pillow/Pillow/issues/439
|
# see https://github.com/python-pillow/Pillow/issues/439
|
||||||
|
|
||||||
data = list(range(256))*3
|
data = list(range(256))*3
|
||||||
lut = numpy.array(data, dtype='uint8')
|
lut = numpy.array(data, dtype=numpy.uint8)
|
||||||
|
|
||||||
im = hopper()
|
im = hopper()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user