| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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) |
| OLD | NEW |