Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(50)

Side by Side Diff: Lib/test/test_enumerate.py

Issue 602: range: lean and mean (Closed) SVN Base: http://svn.python.org/view/*checkout*/python/branches/py3k/
Patch Set: address more concerns Created 1 year, 6 months ago , Downloaded from: http://bugs.python.org/file10183/range_lean_and_mean5.patch
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 import unittest 1 import unittest
2 import sys 2 import sys
3 3
4 from test import test_support 4 from test import test_support
5 5
6 class G: 6 class G:
7 'Sequence using __getitem__' 7 'Sequence using __getitem__'
8 def __init__(self, seqn): 8 def __init__(self, seqn):
9 self.seqn = seqn 9 self.seqn = seqn
10 def __getitem__(self, i): 10 def __getitem__(self, i):
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 class SubclassTestCase(EnumerateTestCase): 114 class SubclassTestCase(EnumerateTestCase):
115 115
116 enum = MyEnum 116 enum = MyEnum
117 117
118 class TestEmpty(EnumerateTestCase): 118 class TestEmpty(EnumerateTestCase):
119 119
120 seq, res = '', [] 120 seq, res = '', []
121 121
122 class TestBig(EnumerateTestCase): 122 class TestBig(EnumerateTestCase):
123 123
124 seq = range(10,20000,2) 124 seq = list(range(10,20000,2))
125 res = list(zip(range(20000), seq)) 125 res = list(zip(range(20000), seq))
126 126
127 class TestReversed(unittest.TestCase): 127 class TestReversed(unittest.TestCase):
128 128
129 def test_simple(self): 129 def test_simple(self):
130 class A: 130 class A:
131 def __getitem__(self, i): 131 def __getitem__(self, i):
132 if i < 5: 132 if i < 5:
133 return str(i) 133 return str(i)
134 raise StopIteration 134 raise StopIteration
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 import sys 205 import sys
206 if verbose and hasattr(sys, "gettotalrefcount"): 206 if verbose and hasattr(sys, "gettotalrefcount"):
207 counts = [None] * 5 207 counts = [None] * 5
208 for i in range(len(counts)): 208 for i in range(len(counts)):
209 test_support.run_unittest(*testclasses) 209 test_support.run_unittest(*testclasses)
210 counts[i] = sys.gettotalrefcount() 210 counts[i] = sys.gettotalrefcount()
211 print(counts) 211 print(counts)
212 212
213 if __name__ == "__main__": 213 if __name__ == "__main__":
214 test_main(verbose=True) 214 test_main(verbose=True)
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld r483