summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_enumerate.py
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2012-10-06 12:03:24 (GMT)
committerArmin Ronacher <armin.ronacher@active-4.com>2012-10-06 12:03:24 (GMT)
commitaa9a79d27958ae5afb6c8769a2b342d98677c091 (patch)
tree24d49f530111a345c57f053a7f40652fa51d27a3 /Lib/test/test_enumerate.py
parentef08fb1f040cb51e752c6b1322008714262fbf3e (diff)
downloadcpython-aa9a79d27958ae5afb6c8769a2b342d98677c091.zip
cpython-aa9a79d27958ae5afb6c8769a2b342d98677c091.tar.gz
cpython-aa9a79d27958ae5afb6c8769a2b342d98677c091.tar.bz2
Issue #16148: implemented PEP 424
Diffstat (limited to 'Lib/test/test_enumerate.py')
-rw-r--r--Lib/test/test_enumerate.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/Lib/test/test_enumerate.py b/Lib/test/test_enumerate.py
index 2e904cf..c0560fe 100644
--- a/Lib/test/test_enumerate.py
+++ b/Lib/test/test_enumerate.py
@@ -1,4 +1,5 @@
import unittest
+import operator
import sys
import pickle
@@ -168,15 +169,13 @@ class TestReversed(unittest.TestCase, PickleTest):
x = range(1)
self.assertEqual(type(reversed(x)), type(iter(x)))
- @support.cpython_only
def test_len(self):
# This is an implementation detail, not an interface requirement
- from test.test_iterlen import len
for s in ('hello', tuple('hello'), list('hello'), range(5)):
- self.assertEqual(len(reversed(s)), len(s))
+ self.assertEqual(operator.length_hint(reversed(s)), len(s))
r = reversed(s)
list(r)
- self.assertEqual(len(r), 0)
+ self.assertEqual(operator.length_hint(r), 0)
class SeqWithWeirdLen:
called = False
def __len__(self):
@@ -187,7 +186,7 @@ class TestReversed(unittest.TestCase, PickleTest):
def __getitem__(self, index):
return index
r = reversed(SeqWithWeirdLen())
- self.assertRaises(ZeroDivisionError, len, r)
+ self.assertRaises(ZeroDivisionError, operator.length_hint, r)
def test_gc(self):