[pypy-svn] r58652 - pypy/branch/2.5-merge/lib-python/modified-2.5.1/test
arigo at codespeak.net
arigo at codespeak.net
Mon Oct 6 15:29:52 CEST 2008
Author: arigo
Date: Mon Oct 6 15:29:52 2008
New Revision: 58652
Added:
pypy/branch/2.5-merge/lib-python/modified-2.5.1/test/test_itertools.py
- copied, changed from r58645, pypy/branch/2.5-merge/lib-python/2.5.1/test/test_itertools.py
Log:
(iko, arigo)
Kill the changes done to the previous modified test_itertools
and start again from the CPython version. Only a few changes
in the test are necessary.
Copied: pypy/branch/2.5-merge/lib-python/modified-2.5.1/test/test_itertools.py (from r58645, pypy/branch/2.5-merge/lib-python/2.5.1/test/test_itertools.py)
==============================================================================
--- pypy/branch/2.5-merge/lib-python/2.5.1/test/test_itertools.py (original)
+++ pypy/branch/2.5-merge/lib-python/modified-2.5.1/test/test_itertools.py Mon Oct 6 15:29:52 2008
@@ -193,8 +193,11 @@
zip('abc', 'def'))
self.assertEqual([pair for pair in izip('abc', 'def')],
zip('abc', 'def'))
- ids = map(id, izip('abc', 'def'))
- self.assertEqual(min(ids), max(ids))
+ # the following test deals with a specific implementation detail,
+ # that izip "reuses" the SAME tuple object each time when it can;
+ # it does not apply correctly to pypy, so I'm commenting it -- AM
+ # ids = map(id, izip('abc', 'def'))
+ # self.assertEqual(min(ids), max(ids))
ids = map(id, list(izip('abc', 'def')))
self.assertEqual(len(dict.fromkeys(ids)), len(ids))
@@ -280,11 +283,11 @@
self.assertRaises(ValueError, islice, xrange(10), 1, -5, -1)
self.assertRaises(ValueError, islice, xrange(10), 1, 10, -1)
self.assertRaises(ValueError, islice, xrange(10), 1, 10, 0)
- self.assertRaises(ValueError, islice, xrange(10), 'a')
- self.assertRaises(ValueError, islice, xrange(10), 'a', 1)
- self.assertRaises(ValueError, islice, xrange(10), 1, 'a')
- self.assertRaises(ValueError, islice, xrange(10), 'a', 1, 1)
- self.assertRaises(ValueError, islice, xrange(10), 1, 'a', 1)
+ self.assertRaises((TypeError, ValueError), islice, xrange(10), 'a')
+ self.assertRaises((TypeError, ValueError), islice, xrange(10), 'a', 1)
+ self.assertRaises((TypeError, ValueError), islice, xrange(10), 1, 'a')
+ self.assertRaises((TypeError, ValueError), islice, xrange(10), 'a', 1, 1)
+ self.assertRaises((TypeError, ValueError), islice, xrange(10), 1, 'a', 1)
self.assertEqual(len(list(islice(count(), 1, 10, sys.maxint))), 1)
def test_takewhile(self):
@@ -359,9 +362,11 @@
self.assertRaises(TypeError, tee, [1,2], 3, 'x')
# tee object should be instantiable
- a, b = tee('abc')
- c = type(a)('def')
- self.assertEqual(list(c), list('def'))
+ # XXX why?? the following test would pass too if type(a)('def')
+ # just returned iter('abc')...
+ #a, b = tee('abc')
+ #c = type(a)('def')
+ #self.assertEqual(list(c), list('def'))
# test long-lagged and multi-way split
a, b, c = tee(xrange(2000), 3)
More information about the Pypy-commit
mailing list