From 2f653c19f4ef01f326692a2e2a8111eeaa4286ac Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Wed, 6 Feb 2008 22:45:43 +0000 Subject: Reversed UserLists are not required to support __length_hint__. --- Lib/test/test_iterlen.py | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/Lib/test/test_iterlen.py b/Lib/test/test_iterlen.py index 93b77b6..75e7a16 100644 --- a/Lib/test/test_iterlen.py +++ b/Lib/test/test_iterlen.py @@ -45,7 +45,6 @@ import unittest from test import test_support from itertools import repeat from collections import deque -from UserList import UserList from builtins import len as _len n = 10 @@ -196,43 +195,6 @@ class TestListReversed(TestInvariantWithoutMutations): d.extend(range(20)) self.assertEqual(len(it), 0) -class TestSeqIter(TestInvariantWithoutMutations): - - def setUp(self): - self.it = iter(UserList(range(n))) - - def test_mutation(self): - d = UserList(range(n)) - it = iter(d) - next(it) - next(it) - self.assertEqual(len(it), n-2) - d.append(n) - self.assertEqual(len(it), n-1) # grow with append - d[1:] = [] - self.assertEqual(len(it), 0) - self.assertEqual(list(it), []) - d.extend(range(20)) - self.assertEqual(len(it), 0) - -class TestSeqIterReversed(TestInvariantWithoutMutations): - - def setUp(self): - self.it = reversed(UserList(range(n))) - - def test_mutation(self): - d = UserList(range(n)) - it = reversed(d) - next(it) - next(it) - self.assertEqual(len(it), n-2) - d.append(n) - self.assertEqual(len(it), n-2) # ignore append - d[1:] = [] - self.assertEqual(len(it), 0) - self.assertEqual(list(it), []) # confirm invariant - d.extend(range(20)) - self.assertEqual(len(it), 0) def test_main(): @@ -249,8 +211,6 @@ def test_main(): TestSet, TestList, TestListReversed, - TestSeqIter, - TestSeqIterReversed, ] test_support.run_unittest(*unittests) -- cgit v0.12