diff options
author | Rémi Cardona <remi.cardona@free.fr> | 2014-07-16 20:35:16 +0200 |
---|---|---|
committer | Rémi Cardona <remi.cardona@free.fr> | 2014-07-16 20:35:16 +0200 |
commit | e9945844342c166d5f095b4c261c5b70829dcc7a (patch) | |
tree | 12a3d593b2f75fe5381f1a230519aa494e6afe8c /test | |
parent | 90e206fe98d7c057316b272f651373376a2d3539 (diff) | |
download | logilab-common-e9945844342c166d5f095b4c261c5b70829dcc7a.tar.gz |
Use next(iterator) instead of py3k incompatible iterator.next() (related to #264017)
Requires python >= 2.6.
Diffstat (limited to 'test')
-rw-r--r-- | test/unittest_table.py | 4 | ||||
-rw-r--r-- | test/unittest_tree.py | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/test/unittest_table.py b/test/unittest_table.py index 7c58d69..2ce566a 100644 --- a/test/unittest_table.py +++ b/test/unittest_table.py @@ -70,8 +70,8 @@ class TableTC(TestCase): def test_iterable(self): """test iter(table)""" it = iter(self.table) - self.assertTrue(it.next() == self.table.data[0]) - self.assertTrue(it.next() == self.table.data[1]) + self.assertTrue(next(it) == self.table.data[0]) + self.assertTrue(next(it) == self.table.data[1]) def test_get_rows(self): """tests Table.get_rows()""" diff --git a/test/unittest_tree.py b/test/unittest_tree.py index fb8e303..ea5af81 100644 --- a/test/unittest_tree.py +++ b/test/unittest_tree.py @@ -189,11 +189,11 @@ class PostfixedDepthFirstIterator_ClassTest(TestCase): def test_known_values_next(self): L = ['child_2_1', 'child_3_1', 'child_2_2', 'child_1_1', 'child_2_3', 'child_1_2', 'root'] iter = PostfixedDepthFirstIterator(self.o) - o = iter.next() + o = next(iter) i = 0 while o: self.assertEqual(o.id, L[i]) - o = iter.next() + o = next(iter) i += 1 @@ -235,11 +235,11 @@ class PrefixedDepthFirstIterator_ClassTest(TestCase): def test_known_values_next(self): L = ['root', 'child_1_1', 'child_2_1', 'child_2_2', 'child_3_1', 'child_1_2', 'child_2_3'] iter = PrefixedDepthFirstIterator(self.o) - o = iter.next() + o = next(iter) i = 0 while o: self.assertEqual(o.id, L[i]) - o = iter.next() + o = next(iter) i += 1 |