mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-12 12:30:16 +08:00
Fix Py3 range incompatibilities
This commit is contained in:
@@ -388,8 +388,8 @@ class Picture(object):
|
||||
|
||||
def __iter__(self):
|
||||
"""Iterates over all pixels in the image."""
|
||||
for x in xrange(self.width):
|
||||
for y in xrange(self.height):
|
||||
for x in range(self.width):
|
||||
for y in range(self.height):
|
||||
yield self._makepixel(x, y)
|
||||
|
||||
def __getitem__(self, xy_index):
|
||||
|
||||
@@ -67,9 +67,9 @@ def test_modify():
|
||||
def test_pixel_rgb():
|
||||
pic = novice.Picture.from_size((3, 3), color=(10, 10, 10))
|
||||
pixel = pic[0, 0]
|
||||
pixel.rgb = range(3)
|
||||
pixel.rgb = np.arange(3)
|
||||
|
||||
assert_equal(pixel.rgb, range(3))
|
||||
assert_equal(pixel.rgb, np.arange(3))
|
||||
for i, channel in enumerate((pixel.red, pixel.green, pixel.blue)):
|
||||
assert_equal(channel, i)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user