diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-05-25 19:01:08 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-05-25 19:01:08 (GMT) |
commit | 20665599131379d7cd9e6a447551f252a2b115c5 (patch) | |
tree | 9740317886633483e120503d6b99c99a7b055e61 /Lib/test/test_enumerate.py | |
parent | 172e06e0194f7804eee74ea02af77eb2f8f32c4f (diff) | |
download | cpython-20665599131379d7cd9e6a447551f252a2b115c5.zip cpython-20665599131379d7cd9e6a447551f252a2b115c5.tar.gz cpython-20665599131379d7cd9e6a447551f252a2b115c5.tar.bz2 |
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.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_enumerate.py b/Lib/test/test_enumerate.py index 4398f84..e38389a 100644 --- a/Lib/test/test_enumerate.py +++ b/Lib/test/test_enumerate.py @@ -204,6 +204,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): |