[Python-checkins] CVS: python/dist/src/Lib/test test_StringIO.py,1.8,1.9

Barry Warsaw bwarsaw@users.sourceforge.net
Tue, 25 Sep 2001 14:40:06 -0700


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

Modified Files:
	test_StringIO.py 
Log Message:
test_iterator(): Don't do a type comparison to see if it's an
iterator, just test to make sure it has the two required iterator
protocol methods __iter__() and next() -- actually just test
hasattr-ness.


Index: test_StringIO.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_StringIO.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** test_StringIO.py	2001/09/24 17:34:52	1.8
--- test_StringIO.py	2001/09/25 21:40:04	1.9
***************
*** 58,63 ****
      def test_iterator(self):
          eq = self.assertEqual
          it = iter(self._fp)
!         self.failUnless(isinstance(it, types.FunctionIterType))
          i = 0
          for line in self._fp:
--- 58,66 ----
      def test_iterator(self):
          eq = self.assertEqual
+         unless = self.failUnless
          it = iter(self._fp)
!         # Does this object support the iteration protocol?
!         unless(hasattr(it, '__iter__'))
!         unless(hasattr(it, 'next'))
          i = 0
          for line in self._fp: