[Python-checkins] python/dist/src/Lib/test test_itertools.py,1.2,1.3

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Thu, 06 Feb 2003 21:33:00 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv2842/Lib/test

Modified Files:
	test_itertools.py 
Log Message:
SF bug #681003: itertools issues

* Fixed typo in exception message for times()
* Filled in missing times_traverse()
* Document reasons that imap() did not adopt a None fill-in feature
* Document that count(sys.maxint) will wrap-around on overflow
* Add overflow test to islice()
* Check that starmap()'s argument returns a tuple
* Verify that imap()'s tuple re-use is safe
* Make a similar tuple re-use (with safety check) for izip()



Index: test_itertools.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_itertools.py	1 Feb 2003 02:33:45 -0000	1.2
--- test_itertools.py	7 Feb 2003 05:32:58 -0000	1.3
***************
*** 2,5 ****
--- 2,6 ----
  from test import test_support
  from itertools import *
+ import sys
  
  class TestBasicOps(unittest.TestCase):
***************
*** 48,51 ****
--- 49,53 ----
          self.assertEqual(list(starmap(operator.pow, zip(range(3), range(1,7)))),
                           [0**1, 1**2, 2**3])
+         self.assertRaises(TypeError, list, starmap(operator.pow, [[4,5]]))
  
      def test_islice(self):
***************
*** 72,75 ****
--- 74,78 ----
          self.assertRaises(ValueError, islice, xrange(10), 1, 10, -1)
          self.assertRaises(ValueError, islice, xrange(10), 1, 10, 0)
+         self.assertEqual(len(list(islice(count(), 1, 10, sys.maxint))), 1)
  
      def test_takewhile(self):