Commit ea874f65 authored by Martijn Pieters's avatar Martijn Pieters

Add slicing tests that demonstrate the 64-bit problem

parent 75a5f713
...@@ -1686,6 +1686,7 @@ def test_Wrapper_gc(): ...@@ -1686,6 +1686,7 @@ def test_Wrapper_gc():
def test_proxying(): def test_proxying():
"""Make sure that recent python slots are proxied. """Make sure that recent python slots are proxied.
>>> import sys
>>> import Acquisition >>> import Acquisition
>>> class Impl(Acquisition.Implicit): >>> class Impl(Acquisition.Implicit):
... pass ... pass
...@@ -1702,6 +1703,9 @@ def test_proxying(): ...@@ -1702,6 +1703,9 @@ def test_proxying():
... def __iter__(self): ... def __iter__(self):
... print 'iterating...' ... print 'iterating...'
... return iter((42,)) ... return iter((42,))
... def __getslice__(self, start, end):
... print 'slicing...'
... return (start, end)
The naked class behaves like this: The naked class behaves like this:
...@@ -1715,6 +1719,12 @@ def test_proxying(): ...@@ -1715,6 +1719,12 @@ def test_proxying():
>>> list(c) >>> list(c)
iterating... iterating...
[42] [42]
>>> c[5:10]
slicing...
(5, 10)
>>> c[5:] == (5, sys.maxint)
slicing...
True
Let's put c in the context of i: Let's put c in the context of i:
...@@ -1732,6 +1742,12 @@ def test_proxying(): ...@@ -1732,6 +1742,12 @@ def test_proxying():
>>> list(i.c) >>> list(i.c)
iterating... iterating...
[42] [42]
>>> i.c[5:10]
slicing...
(5, 10)
>>> i.c[5:] == (5, sys.maxint)
slicing...
True
Let's let's test the same again with an explicit wrapper: Let's let's test the same again with an explicit wrapper:
...@@ -1751,6 +1767,9 @@ def test_proxying(): ...@@ -1751,6 +1767,9 @@ def test_proxying():
... def __iter__(self): ... def __iter__(self):
... print 'iterating...' ... print 'iterating...'
... return iter((42,)) ... return iter((42,))
... def __getslice__(self, start, end):
... print 'slicing...'
... return (start, end)
The naked class behaves like this: The naked class behaves like this:
...@@ -1764,6 +1783,12 @@ def test_proxying(): ...@@ -1764,6 +1783,12 @@ def test_proxying():
>>> list(c) >>> list(c)
iterating... iterating...
[42] [42]
>>> c[5:10]
slicing...
(5, 10)
>>> c[5:] == (5, sys.maxint)
slicing...
True
Let's put c in the context of i: Let's put c in the context of i:
...@@ -1781,6 +1806,12 @@ def test_proxying(): ...@@ -1781,6 +1806,12 @@ def test_proxying():
>>> list(i.c) >>> list(i.c)
iterating... iterating...
[42] [42]
>>> i.c[5:10]
slicing...
(5, 10)
>>> i.c[5:] == (5, sys.maxint)
slicing...
True
Finally let's check that https://bugs.launchpad.net/zope2/+bug/360761 Finally let's check that https://bugs.launchpad.net/zope2/+bug/360761
has been fixed: has been fixed:
......
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