diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-05-08 16:51:16 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-05-08 16:51:16 (GMT) |
commit | 06507eb7914a604343603505d2ccacdbd91c4f38 (patch) | |
tree | c065ca2de026da2fc5076bbefe9411497f2affc5 /Lib/test/test_enumerate.py | |
parent | e3ef5f1201601190cd72fb3f952165a4bbdf2dc8 (diff) | |
download | cpython-06507eb7914a604343603505d2ccacdbd91c4f38.zip cpython-06507eb7914a604343603505d2ccacdbd91c4f38.tar.gz cpython-06507eb7914a604343603505d2ccacdbd91c4f38.tar.bz2 |
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
........
Diffstat (limited to 'Lib/test/test_enumerate.py')
-rw-r--r-- | Lib/test/test_enumerate.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/Lib/test/test_enumerate.py b/Lib/test/test_enumerate.py index cdb9e7e..315069c4 100644 --- a/Lib/test/test_enumerate.py +++ b/Lib/test/test_enumerate.py @@ -199,26 +199,31 @@ class TestReversed(unittest.TestCase): self.assertEqual(rc, sys.getrefcount(r)) -class TestStart(EnumerateTestCase): +class EnumerateStartTestCase(EnumerateTestCase): - enum = lambda i: enumerate(i, start=11) - seq, res = 'abc', [(1, 'a'), (2, 'b'), (3, 'c')] + def test_basicfunction(self): + e = self.enum(self.seq) + self.assertEqual(iter(e), e) + self.assertEqual(list(self.enum(self.seq)), self.res) + + +class TestStart(EnumerateStartTestCase): + + enum = lambda self, i: enumerate(i, start=11) + seq, res = 'abc', [(11, 'a'), (12, 'b'), (13, 'c')] -class TestLongStart(EnumerateTestCase): +class TestLongStart(EnumerateStartTestCase): - enum = lambda i: enumerate(i, start=sys.maxsize+1) + enum = lambda self, i: enumerate(i, start=sys.maxsize+1) seq, res = 'abc', [(sys.maxsize+1,'a'), (sys.maxsize+2,'b'), (sys.maxsize+3,'c')] def test_main(verbose=None): - testclasses = (EnumerateTestCase, SubclassTestCase, TestEmpty, TestBig, - TestReversed) - support.run_unittest(*testclasses) + support.run_unittest(__name__) # verify reference counting - import sys if verbose and hasattr(sys, "gettotalrefcount"): counts = [None] * 5 for i in range(len(counts)): |