PEP 3114: rename .next() to .__next__() and add next() builtin.

This commit is contained in:
Georg Brandl 2007-04-21 15:47:16 +00:00
parent 4d2adcca52
commit a18af4e7a2
83 changed files with 495 additions and 425 deletions

View file

@ -1518,11 +1518,11 @@ class TestProxyFileBase(TestBase):
# Iterate by line
proxy.seek(0)
iterator = iter(proxy)
self.assert_(iterator.next() == 'foo' + os.linesep)
self.assert_(iterator.next() == 'bar' + os.linesep)
self.assert_(iterator.next() == 'fred' + os.linesep)
self.assert_(iterator.next() == 'bob')
self.assertRaises(StopIteration, lambda: iterator.next())
self.assert_(next(iterator) == 'foo' + os.linesep)
self.assert_(next(iterator) == 'bar' + os.linesep)
self.assert_(next(iterator) == 'fred' + os.linesep)
self.assert_(next(iterator) == 'bob')
self.assertRaises(StopIteration, next, iterator)
def _test_seek_and_tell(self, proxy):
# Seek and use tell to check position