diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2010-11-30 01:01:02 +0000 |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2010-11-30 01:01:02 +0000 |
commit | 929266ecc231df8da371dbc7bb6327fd865ea512 (patch) | |
tree | 5aec553128261bc91cd469f8a5b0f95429d83454 /Lib/test/test_collections.py | |
parent | eb8d62d37ce21e7bdb577db3638b80387c9e80c4 (diff) | |
download | cpython-929266ecc231df8da371dbc7bb6327fd865ea512.tar.gz |
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__.
........
Diffstat (limited to 'Lib/test/test_collections.py')
-rw-r--r-- | Lib/test/test_collections.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index dc61fa4147..988db92e16 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -328,7 +328,14 @@ class TestOneTrickPonyABCs(ABCTestCase): for x in samples: self.assertTrue(isinstance(x, Iterator), repr(x)) self.assertTrue(issubclass(type(x), Iterator), repr(type(x))) - self.validate_abstract_methods(Iterator, '__next__') + self.validate_abstract_methods(Iterator, '__next__', '__iter__') + + # Issue 10565 + class NextOnly: + def __next__(self): + yield 1 + raise StopIteration + self.assertFalse(isinstance(NextOnly(), Iterator)) def test_Sized(self): non_samples = [None, 42, 3.14, 1j, |