Merge lp:~cjwatson/storm/py3-next into lp:storm

Proposed by Colin Watson on 2019-08-11
Status: Merged
Merged at revision: 516
Proposed branch: lp:~cjwatson/storm/py3-next
Merge into: lp:storm
Diff against target: 44 lines (+8/-8)
2 files modified
tests/databases/base.py (+7/-7)
tests/store/base.py (+1/-1)
To merge this branch: bzr merge lp:~cjwatson/storm/py3-next
Reviewer Review Type Date Requested Status
Kristian Glass (community) Approve on 2019-08-12
Storm Developers 2019-08-11 Pending
Review via email: mp+371163@code.launchpad.net

Commit message

Use next(iterator) rather than iterator.next().

Description of the change

This works as of Python 2.6, and is compatible with Python 3.

To post a comment you must log in.
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/databases/base.py'
2--- tests/databases/base.py 2019-06-07 17:14:33 +0000
3+++ tests/databases/base.py 2019-08-11 10:59:55 +0000
4@@ -195,12 +195,12 @@
5 "ORDER BY id DESC")
6 iter1 = iter(result1)
7 iter2 = iter(result2)
8- self.assertEquals(iter1.next(), (10, "Title 10"))
9- self.assertEquals(iter2.next(), (20, "Title 20"))
10- self.assertEquals(iter1.next(), (20, "Title 20"))
11- self.assertEquals(iter2.next(), (10, "Title 10"))
12- self.assertRaises(StopIteration, iter1.next)
13- self.assertRaises(StopIteration, iter2.next)
14+ self.assertEquals(next(iter1), (10, "Title 10"))
15+ self.assertEquals(next(iter2), (20, "Title 20"))
16+ self.assertEquals(next(iter1), (20, "Title 20"))
17+ self.assertEquals(next(iter2), (10, "Title 10"))
18+ self.assertRaises(StopIteration, next, iter1)
19+ self.assertRaises(StopIteration, next, iter2)
20
21 def test_get_insert_identity(self):
22 result = self.connection.execute("INSERT INTO test (title) "
23@@ -386,7 +386,7 @@
24 def test_wb_result_iter_goes_through_from_database(self):
25 result = self.connection.execute("SELECT one, two FROM number")
26 result.from_database = self.from_database
27- self.assertEquals(iter(result).next(), (2, 3))
28+ self.assertEquals(next(iter(result)), (2, 3))
29
30 def test_rowcount_insert(self):
31 # All supported backends support rowcount, so far.
32
33=== modified file 'tests/store/base.py'
34--- tests/store/base.py 2019-06-07 17:14:33 +0000
35+++ tests/store/base.py 2019-08-11 10:59:55 +0000
36@@ -1170,7 +1170,7 @@
37
38 def test_find_values_with_no_arguments(self):
39 result = self.store.find(Foo).order_by(Foo.id)
40- self.assertRaises(FeatureError, result.values().next)
41+ self.assertRaises(FeatureError, next, result.values())
42
43 def test_find_slice_values(self):
44 values = self.store.find(Foo).order_by(Foo.id)[1:2].values(Foo.id)

Subscribers

People subscribed via source and target branches

to status/vote changes: