SF patch 695710: fix bug 678519: cStringIO self iterator

(requested by GvR. patch contributed by Michael Stone)
This commit is contained in:
Raymond Hettinger 2003-04-24 15:50:11 +00:00
parent 024aaa1bfe
commit 352f9477da
2 changed files with 59 additions and 68 deletions

View file

@ -58,10 +58,10 @@ class TestGenericStringIO(unittest.TestCase):
def test_iterator(self):
eq = self.assertEqual
unless = self.failUnless
it = iter(self._fp)
eq(iter(self._fp), self._fp)
# Does this object support the iteration protocol?
unless(hasattr(it, '__iter__'))
unless(hasattr(it, 'next'))
unless(hasattr(self._fp, '__iter__'))
unless(hasattr(self._fp, 'next'))
i = 0
for line in self._fp:
eq(line, self._line + '\n')