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
=== modified file 'tests/databases/base.py'
--- tests/databases/base.py 2019-06-07 17:14:33 +0000
+++ tests/databases/base.py 2019-08-11 10:59:55 +0000
@@ -195,12 +195,12 @@
195 "ORDER BY id DESC")195 "ORDER BY id DESC")
196 iter1 = iter(result1)196 iter1 = iter(result1)
197 iter2 = iter(result2)197 iter2 = iter(result2)
198 self.assertEquals(iter1.next(), (10, "Title 10"))198 self.assertEquals(next(iter1), (10, "Title 10"))
199 self.assertEquals(iter2.next(), (20, "Title 20"))199 self.assertEquals(next(iter2), (20, "Title 20"))
200 self.assertEquals(iter1.next(), (20, "Title 20"))200 self.assertEquals(next(iter1), (20, "Title 20"))
201 self.assertEquals(iter2.next(), (10, "Title 10"))201 self.assertEquals(next(iter2), (10, "Title 10"))
202 self.assertRaises(StopIteration, iter1.next)202 self.assertRaises(StopIteration, next, iter1)
203 self.assertRaises(StopIteration, iter2.next)203 self.assertRaises(StopIteration, next, iter2)
204204
205 def test_get_insert_identity(self):205 def test_get_insert_identity(self):
206 result = self.connection.execute("INSERT INTO test (title) "206 result = self.connection.execute("INSERT INTO test (title) "
@@ -386,7 +386,7 @@
386 def test_wb_result_iter_goes_through_from_database(self):386 def test_wb_result_iter_goes_through_from_database(self):
387 result = self.connection.execute("SELECT one, two FROM number")387 result = self.connection.execute("SELECT one, two FROM number")
388 result.from_database = self.from_database388 result.from_database = self.from_database
389 self.assertEquals(iter(result).next(), (2, 3))389 self.assertEquals(next(iter(result)), (2, 3))
390390
391 def test_rowcount_insert(self):391 def test_rowcount_insert(self):
392 # All supported backends support rowcount, so far.392 # All supported backends support rowcount, so far.
393393
=== modified file 'tests/store/base.py'
--- tests/store/base.py 2019-06-07 17:14:33 +0000
+++ tests/store/base.py 2019-08-11 10:59:55 +0000
@@ -1170,7 +1170,7 @@
11701170
1171 def test_find_values_with_no_arguments(self):1171 def test_find_values_with_no_arguments(self):
1172 result = self.store.find(Foo).order_by(Foo.id)1172 result = self.store.find(Foo).order_by(Foo.id)
1173 self.assertRaises(FeatureError, result.values().next)1173 self.assertRaises(FeatureError, next, result.values())
11741174
1175 def test_find_slice_values(self):1175 def test_find_slice_values(self):
1176 values = self.store.find(Foo).order_by(Foo.id)[1:2].values(Foo.id)1176 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: