Benjamin Peterson avatar Benjamin Peterson committed 8ff8f0a

run and fix enumerate start test cases #8636

Comments (0)

Files changed (1)

Lib/test/test_enumerate.py

         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 TestLongStart(EnumerateTestCase):
+class TestStart(EnumerateStartTestCase):
 
-    enum = lambda i: enumerate(i, start=sys.maxint+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.maxint+1)
     seq, res = 'abc', [(sys.maxint+1,'a'), (sys.maxint+2,'b'),
                        (sys.maxint+3,'c')]
 
 
 def test_main(verbose=None):
-    testclasses = (EnumerateTestCase, SubclassTestCase, TestEmpty, TestBig,
-                   TestReversed)
-    test_support.run_unittest(*testclasses)
+    test_support.run_unittest(__name__)
 
     # verify reference counting
-    import sys
     if verbose and hasattr(sys, "gettotalrefcount"):
         counts = [None] * 5
         for i in xrange(len(counts)):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.