mirror of
https://github.com/python/cpython.git
synced 2025-11-11 11:01:39 +00:00
Merged revisions 80993 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r80993 | benjamin.peterson | 2010-05-08 11:51:16 -0500 (Sat, 08 May 2010) | 9 lines
Merged revisions 80991 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r80991 | benjamin.peterson | 2010-05-08 11:44:52 -0500 (Sat, 08 May 2010) | 1 line
run and fix enumerate start test cases #8636
........
................
This commit is contained in:
parent
c9e833faa0
commit
23b1e6bbce
1 changed files with 14 additions and 9 deletions
|
|
@ -199,26 +199,31 @@ def f():
|
||||||
self.assertEqual(rc, sys.getrefcount(r))
|
self.assertEqual(rc, sys.getrefcount(r))
|
||||||
|
|
||||||
|
|
||||||
class TestStart(EnumerateTestCase):
|
class EnumerateStartTestCase(EnumerateTestCase):
|
||||||
|
|
||||||
enum = lambda i: enumerate(i, start=11)
|
def test_basicfunction(self):
|
||||||
seq, res = 'abc', [(1, 'a'), (2, 'b'), (3, 'c')]
|
e = self.enum(self.seq)
|
||||||
|
self.assertEqual(iter(e), e)
|
||||||
|
self.assertEqual(list(self.enum(self.seq)), self.res)
|
||||||
|
|
||||||
|
|
||||||
class TestLongStart(EnumerateTestCase):
|
class TestStart(EnumerateStartTestCase):
|
||||||
|
|
||||||
enum = lambda i: enumerate(i, start=sys.maxsize+1)
|
enum = lambda self, i: enumerate(i, start=11)
|
||||||
|
seq, res = 'abc', [(11, 'a'), (12, 'b'), (13, 'c')]
|
||||||
|
|
||||||
|
|
||||||
|
class TestLongStart(EnumerateStartTestCase):
|
||||||
|
|
||||||
|
enum = lambda self, i: enumerate(i, start=sys.maxsize+1)
|
||||||
seq, res = 'abc', [(sys.maxsize+1,'a'), (sys.maxsize+2,'b'),
|
seq, res = 'abc', [(sys.maxsize+1,'a'), (sys.maxsize+2,'b'),
|
||||||
(sys.maxsize+3,'c')]
|
(sys.maxsize+3,'c')]
|
||||||
|
|
||||||
|
|
||||||
def test_main(verbose=None):
|
def test_main(verbose=None):
|
||||||
testclasses = (EnumerateTestCase, SubclassTestCase, TestEmpty, TestBig,
|
support.run_unittest(__name__)
|
||||||
TestReversed)
|
|
||||||
support.run_unittest(*testclasses)
|
|
||||||
|
|
||||||
# verify reference counting
|
# verify reference counting
|
||||||
import sys
|
|
||||||
if verbose and hasattr(sys, "gettotalrefcount"):
|
if verbose and hasattr(sys, "gettotalrefcount"):
|
||||||
counts = [None] * 5
|
counts = [None] * 5
|
||||||
for i in range(len(counts)):
|
for i in range(len(counts)):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue