summaryrefslogtreecommitdiff
path: root/Lib/test/test_collections.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_collections.py')
-rw-r--r--Lib/test/test_collections.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index 94305ab2f4..2d2319fe26 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -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,