summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_enumerate.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-05-25 19:06:24 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-05-25 19:06:24 (GMT)
commitfb3dc94b8c84b91a384c0159c7b126976cbc79fd (patch)
treefcb25463f2542344c70da29ce49198529cf347d1 /Lib/test/test_enumerate.py
parentf5077aa17bc0bcae14524e25cff6635c9398fd57 (diff)
downloadcpython-fb3dc94b8c84b91a384c0159c7b126976cbc79fd.zip
cpython-fb3dc94b8c84b91a384c0159c7b126976cbc79fd.tar.gz
cpython-fb3dc94b8c84b91a384c0159c7b126976cbc79fd.tar.bz2
Merged revisions 81525 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r81525 | mark.dickinson | 2010-05-25 20:01:08 +0100 (Tue, 25 May 2010) | 3 lines Issue #8816: Extra tests for some built-in functions. These tests are ports of IronPython tests. Thanks Gregory Nofi. ........
Diffstat (limited to 'Lib/test/test_enumerate.py')
-rw-r--r--Lib/test/test_enumerate.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_enumerate.py b/Lib/test/test_enumerate.py
index 315069c4..b8b9719 100644
--- a/Lib/test/test_enumerate.py
+++ b/Lib/test/test_enumerate.py
@@ -198,6 +198,18 @@ class TestReversed(unittest.TestCase):
self.fail("non-callable __reversed__ didn't raise!")
self.assertEqual(rc, sys.getrefcount(r))
+ def test_objmethods(self):
+ # Objects must have __len__() and __getitem__() implemented.
+ class NoLen(object):
+ def __getitem__(self): return 1
+ nl = NoLen()
+ self.assertRaises(TypeError, reversed, nl)
+
+ class NoGetItem(object):
+ def __len__(self): return 2
+ ngi = NoGetItem()
+ self.assertRaises(TypeError, reversed, ngi)
+
class EnumerateStartTestCase(EnumerateTestCase):