Commit 0da36eda authored by Tres Seaver's avatar Tres Seaver

Back out support for __reversed__.

Python 2.7 adds B&D checks which break for the C wrapper.
parent 737e25e6
...@@ -137,8 +137,9 @@ class PyProxyBase(object): ...@@ -137,8 +137,9 @@ class PyProxyBase(object):
# Called when we wrap an iterator itself. # Called when we wrap an iterator itself.
return self._wrapped.next() return self._wrapped.next()
def __reversed__(self): # Python 2.7 won't let the C wrapper support __reversed__ :(
return reversed(self._wrapped) #def __reversed__(self):
# return reversed(self._wrapped)
def __contains__(self, item): def __contains__(self, item):
return item in self._wrapped return item in self._wrapped
......
...@@ -341,9 +341,10 @@ class PyProxyBaseTestCase(unittest.TestCase): ...@@ -341,9 +341,10 @@ class PyProxyBaseTestCase(unittest.TestCase):
b.append(x) b.append(x)
self.assertEqual(a, b) self.assertEqual(a, b)
def test___reversed__(self): # Python 2.7 won't let the C wrapper support __reversed__ :(
w = self._makeOne([0, 1, 2, 3]) #def test___reversed__(self):
self.assertEqual(list(reversed(w)), [3, 2, 1, 0]) # w = self._makeOne([0, 1, 2, 3])
# self.assertEqual(list(reversed(w)), [3, 2, 1, 0])
def test___contains__(self): def test___contains__(self):
w = self._makeOne([0, 1, 2, 3]) w = self._makeOne([0, 1, 2, 3])
...@@ -1020,6 +1021,9 @@ class Test_nonOverridable(unittest.TestCase): ...@@ -1020,6 +1021,9 @@ class Test_nonOverridable(unittest.TestCase):
return 'FOO' return 'FOO'
def what(self): def what(self):
return 'FOO' return 'FOO'
p0 = ProxyBase(Foo())
self.assertEqual(p0.who(), 'FOO')
self.assertEqual(p0.what(), 'FOO')
proxy = Proxy(Foo()) proxy = Proxy(Foo())
self.assertEqual(proxy.who(), 'FOO') self.assertEqual(proxy.who(), 'FOO')
self.assertEqual(proxy.what(), 'PROXY') self.assertEqual(proxy.what(), 'PROXY')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment