mirror of
https://github.com/python/cpython.git
synced 2025-08-18 07:41:05 +00:00
Merged revisions 86857 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r86857 | raymond.hettinger | 2010-11-28 22:56:12 -0500 (Sun, 28 Nov 2010) | 1 line Issue #10565: Iterator ABC should require both __next__ and __iter__. ........
This commit is contained in:
parent
30ec1154ac
commit
1fea5c4472
3 changed files with 17 additions and 3 deletions
|
@ -355,8 +355,19 @@ class TestOneTrickPonyABCs(ABCTestCase):
|
|||
for x in samples:
|
||||
self.assertIsInstance(x, Iterator)
|
||||
self.assertTrue(issubclass(type(x), Iterator), repr(type(x)))
|
||||
self.validate_abstract_methods(Iterator, 'next')
|
||||
self.validate_isinstance(Iterator, 'next')
|
||||
self.validate_abstract_methods(Iterator, 'next', '__iter__')
|
||||
|
||||
# Issue 10565
|
||||
class NextOnly:
|
||||
def __next__(self):
|
||||
yield 1
|
||||
raise StopIteration
|
||||
self.assertNotIsInstance(NextOnly(), Iterator)
|
||||
class NextOnlyNew(object):
|
||||
def __next__(self):
|
||||
yield 1
|
||||
raise StopIteration
|
||||
self.assertNotIsInstance(NextOnlyNew(), Iterator)
|
||||
|
||||
def test_Sized(self):
|
||||
non_samples = [None, 42, 3.14, 1j,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue