Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Unified Diff: Lib/test/test_enumerate.py

Issue 25958: Implicit ABCs have no means of "anti-registration"
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_contains.py ('k') | Lib/test/test_iter.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_enumerate.py Mon Aug 15 03:23:23 2016 -0400
+++ b/Lib/test/test_enumerate.py Mon Aug 15 23:52:53 2016 +0200
@@ -223,7 +223,7 @@
def test_objmethods(self):
# Objects must have __len__() and __getitem__() implemented.
class NoLen(object):
- def __getitem__(self): return 1
+ def __getitem__(self, i): return 1
nl = NoLen()
self.assertRaises(TypeError, reversed, nl)
@@ -232,6 +232,13 @@
ngi = NoGetItem()
self.assertRaises(TypeError, reversed, ngi)
+ class Blocked(object):
+ def __getitem__(self, i): return 1
+ def __len__(self): return 2
+ __reversed__ = None
+ b = Blocked()
+ self.assertRaises(TypeError, reversed, b)
+
def test_pickle(self):
for data in 'abc', range(5), tuple(enumerate('abc')), range(1,17,5):
self.check_pickle(reversed(data), list(data)[::-1])
« no previous file with comments | « Lib/test/test_contains.py ('k') | Lib/test/test_iter.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+