python/dist/src/Lib/test test_itertools.py, 1.15.6.1, 1.15.6.2

Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv23521 Modified Files: Tag: release23-maint test_itertools.py Log Message: * Add news item for the previous bugfix * Backport itertoolsmodule.c 1.19 to re-sync Py2.3.1 with Py2.4. Index: test_itertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v retrieving revision 1.15.6.1 retrieving revision 1.15.6.2 diff -C2 -d -r1.15.6.1 -r1.15.6.2 *** test_itertools.py 29 Aug 2003 23:13:16 -0000 1.15.6.1 --- test_itertools.py 30 Aug 2003 22:16:59 -0000 1.15.6.2 *************** *** 88,92 **** self.assertEqual(take(3,izip('abcdef', count())), zip('abcdef', range(3))) self.assertEqual(list(izip('abcdef')), zip('abcdef')) ! self.assertRaises(TypeError, izip) self.assertRaises(TypeError, izip, 3) self.assertRaises(TypeError, izip, range(3), 3) --- 88,92 ---- self.assertEqual(take(3,izip('abcdef', count())), zip('abcdef', range(3))) self.assertEqual(list(izip('abcdef')), zip('abcdef')) ! self.assertEqual(list(izip()), zip()) self.assertRaises(TypeError, izip, 3) self.assertRaises(TypeError, izip, range(3), 3) *************** *** 200,203 **** --- 200,205 ---- def test_StopIteration(self): + self.assertRaises(StopIteration, izip().next) + for f in (chain, cycle, izip): self.assertRaises(StopIteration, f([]).next) *************** *** 502,514 ****
def all(pred, seq): ... "Returns True if pred(x) is True for every element in the iterable" ! ... return not nth(ifilterfalse(pred, seq), 0)
def some(pred, seq): ... "Returns True if pred(x) is True for at least one element in the iterable" ! ... return bool(nth(ifilter(pred, seq), 0))
def no(pred, seq): ... "Returns True if pred(x) is False for every element in the iterable" ! ... return not nth(ifilter(pred, seq), 0)
def padnone(seq): --- 504,520 ---- def all(pred, seq): ... "Returns True if pred(x) is True for every element in the iterable" ! ... return False not in imap(pred, seq)
def some(pred, seq): ... "Returns True if pred(x) is True for at least one element in the iterable" ! ... return True in imap(pred, seq)
def no(pred, seq): ... "Returns True if pred(x) is False for every element in the iterable" ! ... return True not in imap(pred, seq) ! ! >>> def quantify(pred, seq): ! ... "Count how many times the predicate is True in the sequence" ! ... return sum(imap(pred, seq))
def padnone(seq):
no(lambda x: x%2==0, [1, 2, 5, 9]) False
*** 566,569 **** --- 572,578 ---- + + >>> quantify(lambda x: x%2==0, xrange(99)) + 50
list(window('abc'))
participants (1)
-
rhettingerīŧ users.sourceforge.net