Issue #10565: Iterator ABC should require both __next__ and __iter__.
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 @@
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,