[Python-checkins] python/dist/src/Lib/test test_enumerate.py, 1.6,
1.7
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Thu Nov 6 09:06:49 EST 2003
- Previous message: [Python-checkins]
python/dist/src/Lib heapq.py, 1.18, 1.19 mhlib.py,
1.35, 1.36 platform.py, 1.8, 1.9 random.py, 1.57,
1.58 rfc822.py, 1.74, 1.75
- Next message: [Python-checkins] python/dist/src/Misc NEWS,1.885,1.886
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv17028/Lib/test
Modified Files:
test_enumerate.py
Log Message:
Implement and apply PEP 322, reverse iteration
Index: test_enumerate.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_enumerate.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** test_enumerate.py 29 May 2003 07:20:29 -0000 1.6
--- test_enumerate.py 6 Nov 2003 14:06:47 -0000 1.7
***************
*** 125,131 ****
res = zip(range(20000), seq)
def test_main(verbose=None):
! testclasses = (EnumerateTestCase, SubclassTestCase, TestEmpty, TestBig)
test_support.run_unittest(*testclasses)
--- 125,149 ----
res = zip(range(20000), seq)
+ class TestReversed(unittest.TestCase):
+
+ def test_simple(self):
+ class A:
+ def __getitem__(self, i):
+ if i < 5:
+ return str(i)
+ raise StopIteration
+ def __len__(self):
+ return 5
+ for data in 'abc', range(5), tuple(enumerate('abc')), A(), xrange(1,17,5):
+ self.assertEqual(list(data)[::-1], list(reversed(data)))
+ self.assertRaises(TypeError, reversed, {})
+
+ def test_xrange_optimization(self):
+ x = xrange(1)
+ self.assertEqual(type(reversed(x)), type(iter(x)))
def test_main(verbose=None):
! testclasses = (EnumerateTestCase, SubclassTestCase, TestEmpty, TestBig,
! TestReversed)
test_support.run_unittest(*testclasses)
- Previous message: [Python-checkins]
python/dist/src/Lib heapq.py, 1.18, 1.19 mhlib.py,
1.35, 1.36 platform.py, 1.8, 1.9 random.py, 1.57,
1.58 rfc822.py, 1.74, 1.75
- Next message: [Python-checkins] python/dist/src/Misc NEWS,1.885,1.886
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Python-checkins
mailing list