summaryrefslogtreecommitdiff
path: root/Lib/test/test_iter.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_iter.py')
-rw-r--r--Lib/test/test_iter.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_iter.py b/Lib/test/test_iter.py
index a91670b4a1..542b28419e 100644
--- a/Lib/test/test_iter.py
+++ b/Lib/test/test_iter.py
@@ -54,6 +54,14 @@ class UnlimitedSequenceClass:
def __getitem__(self, i):
return i
+class DefaultIterClass:
+ pass
+
+class NoIterClass:
+ def __getitem__(self, i):
+ return i
+ __iter__ = None
+
# Main test suite
class TestCase(unittest.TestCase):
@@ -995,6 +1003,10 @@ class TestCase(unittest.TestCase):
def test_free_after_iterating(self):
check_free_after_iterating(self, iter, SequenceClass, (0,))
+ def test_error_iter(self):
+ for typ in (DefaultIterClass, NoIterClass):
+ self.assertRaises(TypeError, iter, typ())
+
def test_main():
run_unittest(TestCase)