summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_iterlen.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2005-09-24 21:23:05 (GMT)
committerRaymond Hettinger <python@rcn.com>2005-09-24 21:23:05 (GMT)
commit6b27cda64386195cd07dfb686e9486f1c4bc3159 (patch)
tree277a5c96e9683c63b573b508f8c4bd2d1374aed8 /Lib/test/test_iterlen.py
parent9ceebd544516908e67c0f0d92c7a5f484e12beeb (diff)
downloadcpython-6b27cda64386195cd07dfb686e9486f1c4bc3159.zip
cpython-6b27cda64386195cd07dfb686e9486f1c4bc3159.tar.gz
cpython-6b27cda64386195cd07dfb686e9486f1c4bc3159.tar.bz2
Convert iterator __len__() methods to a private API.
Diffstat (limited to 'Lib/test/test_iterlen.py')
-rw-r--r--Lib/test/test_iterlen.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/test_iterlen.py b/Lib/test/test_iterlen.py
index b51263d..1770de2 100644
--- a/Lib/test/test_iterlen.py
+++ b/Lib/test/test_iterlen.py
@@ -43,12 +43,22 @@ enumerate(iter('abc')).
import unittest
from test import test_support
-from itertools import repeat, count
+from itertools import repeat
from collections import deque
from UserList import UserList
+from __builtin__ import len as _len
n = 10
+def len(obj):
+ try:
+ return _len(obj)
+ except TypeError:
+ try:
+ return obj._length_cue()
+ except AttributeError:
+ raise TypeError
+
class TestInvariantWithoutMutations(unittest.TestCase):
def test_invariant(self):