summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_collections.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2010-11-29 03:56:12 (GMT)
committerRaymond Hettinger <python@rcn.com>2010-11-29 03:56:12 (GMT)
commitead22227cce112457b6beba8b008699ea4a3a084 (patch)
tree9dcc912a990ce6e6730f52e71d431ac489eb7b70 /Lib/test/test_collections.py
parent263cbdfdfb0a7fe13f04c1b3188968d7a39d7d09 (diff)
downloadcpython-ead22227cce112457b6beba8b008699ea4a3a084.zip
cpython-ead22227cce112457b6beba8b008699ea4a3a084.tar.gz
cpython-ead22227cce112457b6beba8b008699ea4a3a084.tar.bz2
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.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index f3f8b03..02b9dc3 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -356,8 +356,14 @@ 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)
def test_Sized(self):
non_samples = [None, 42, 3.14, 1j,