mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
PEP 3114: rename .next() to .__next__() and add next() builtin.
This commit is contained in:
parent
4d2adcca52
commit
a18af4e7a2
83 changed files with 495 additions and 425 deletions
|
@ -785,9 +785,9 @@ class GrammarTests(unittest.TestCase):
|
|||
def testGenexps(self):
|
||||
# generator expression tests
|
||||
g = ([x for x in range(10)] for x in range(1))
|
||||
self.assertEqual(g.next(), [x for x in range(10)])
|
||||
self.assertEqual(next(g), [x for x in range(10)])
|
||||
try:
|
||||
g.next()
|
||||
next(g)
|
||||
self.fail('should produce StopIteration exception')
|
||||
except StopIteration:
|
||||
pass
|
||||
|
@ -795,7 +795,7 @@ class GrammarTests(unittest.TestCase):
|
|||
a = 1
|
||||
try:
|
||||
g = (a for d in a)
|
||||
g.next()
|
||||
next(g)
|
||||
self.fail('should produce TypeError')
|
||||
except TypeError:
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue