diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-04-15 08:35:10 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-04-15 08:35:10 -0700 |
commit | 9361471ebf49d31761e8ed9d7dc6512abe3241a9 (patch) | |
tree | 8e01d8226aa0c6073a9c3cf8fbf9fdf88a175d5b /numpy/core | |
parent | a196d789fbb8e72672c73ffcf99c687b5fd3ec3d (diff) | |
parent | c6de09799decbb22bb2d7a44036f53c30356edda (diff) | |
download | numpy-9361471ebf49d31761e8ed9d7dc6512abe3241a9.tar.gz |
Merge pull request #3249 from charris/2to3-apply-next-fixer
2to3: Apply next fixer.
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/tests/test_nditer.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/numpy/core/tests/test_nditer.py b/numpy/core/tests/test_nditer.py index 45fcc2791..31e5a5f10 100644 --- a/numpy/core/tests/test_nditer.py +++ b/numpy/core/tests/test_nditer.py @@ -1,12 +1,13 @@ from __future__ import division, absolute_import, print_function +import sys, warnings + import numpy as np from numpy import array, arange, nditer, all from numpy.compat import asbytes from numpy.testing import * -import sys, warnings -import warnings + def iter_multi_index(i): ret = [] @@ -1210,7 +1211,8 @@ def test_iter_copy(): assert_equal([x[()] for x in i], [x[()] for x in j]) i.iterrange = (2,18) - i.next(); i.next() + next(i) + next(i) j = i.copy() assert_equal([x[()] for x in i], [x[()] for x in j]) @@ -2528,14 +2530,14 @@ def test_0d_iter(): # Basic test for iteration of 0-d arrays: i = nditer([2, 3], ['multi_index'], [['readonly']]*2) assert_equal(i.ndim, 0) - assert_equal(i.next(), (2, 3)) + assert_equal(next(i), (2, 3)) assert_equal(i.multi_index, ()) assert_equal(i.iterindex, 0) - assert_raises(StopIteration, i.next) + assert_raises(StopIteration, next, i) # test reset: i.reset() - assert_equal(i.next(), (2, 3)) - assert_raises(StopIteration, i.next) + assert_equal(next(i), (2, 3)) + assert_raises(StopIteration, next, i) # test forcing to 0-d i = nditer(np.arange(5), ['multi_index'], [['readonly']], op_axes=[()]) @@ -2548,7 +2550,7 @@ def test_0d_iter(): a = np.array(0.5, dtype='f4') i = nditer(a, ['buffered','refs_ok'], ['readonly'], casting='unsafe', op_dtypes=sdt) - vals = i.next() + vals = next(i) assert_equal(vals['a'], 0.5) assert_equal(vals['b'], 0) assert_equal(vals['c'], [[(0.5)]*3]*2) |